of the Month
This can be quite tricky, and does depend on where in the datastep the RENAME statement is placed.
Lets look at the following example:
*** Creating a dataset; data ourdata; infile cards; input x y z; cards; 1 2 3 4 5 6 ; run;
*** Modifying the variable names; data ourdata_modified; set ourdata (rename=(x=a)); rename y=b; if a=1 then do; *More steps; end; if y=5 then do; *More steps; end; run;
In the example, the variable x is renamed to a PRIOR to entry into the datastep, meaning that the variable a is known and can be manipulated within the step. This is different to the variable y - this is renamed as the observation is passed into the dataset OURDATA_MODIFIED, meaning that the variable y is still available inside the datastep for manipulation.
Updated October 1, 2007