Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing values for existing data sets? 1

Status
Not open for further replies.

cosmid

Programmer
Feb 14, 2008
73
US
Hi,

I have two data sets that I need to combine them together. One of the problem I encountered is that there are different values that represent the same object.

For example, for variable A, there are values x, y, and z and they all represent 1. I am asked to change all the values from x, y, and z to a single common value such as x. How do I do that? Other than opening up the data set and change the value manually.

Thanks!
 
You can use proc format to change the values.

Code:
proc format;
VALUE fmtvalue x = 1
	 	      y = 1
	 	      z = 1;
run; 

data yourdata;
set yourdata;
column1 = put(column1,fmtvalue.);
run;

If the column you are wanting to change is character put a $ in front of your format alias...so "$fmtvalue". If numeric, leave the $ off as in the above example.

Or if you have a lot of values to change, you could make a table in Excel, import it, join it to the column in question to get the alternate value.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top