Tuesday, May 23, 2017

SAS Macro – Namer (SAS) (Pt. 2)

In order to re-join the unique data sets back together into one single set, the variable names must be modified so that data integrity is maintained. To achieve this, compile and run the following macro:


%macro namer;

%do i = 1 %to 3; /* Number of Dupout sets */

Data DupOut&i;
Set DupOut&i;
Rename VARA = VARA&i;
Rename DATAVAL = DATAVAL&i;
Run;

%end;

%mend;


“i” in this particular case is going to represent the total number of sets that were created from the splitter macro.

Illustrated, what this macro accomplishes is the following:


In the next article, we will review the final macro, and the last step required to re-assemble the data set. 

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.