In the case of this example, we are going to assume that you want to re-name and re-format a variable column within a data set.
Here are the steps:
data newset; /* Name of the new set */
set oldest; /* Name of the old set that needs to be corrected */
FixedVar1 = put(OldVar1, 16.);
FixedVar2 = put(OldVar2, 16.);
/* Here we are creating two new variable columns from values found in variable columns OldVar1 and OldVar2. The PUT function allows for the data variables to be re-formatted as they are assigned. */
drop OldVar1 OldVar2;
/* Now we are dropping the old variables completely from the table */
rename FixedVar1 = OldVar1;
rename FixedVar2 = OldVar2;
/* The rename statements now assign the names of the previous variables to the new formatted variables */
run;
The end result of the above listed code creates a new SAS data set that contains the same variable names of the previous data set, however, the formats of the variables will differ.
The end result of the above listed code creates a new SAS data set that contains the same variable names of the previous data set, however, the formats of the variables will differ.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.