Posted By

sarathannapareddy on 08/11/09


data merge macros sas step DO-LOOP

Versions (?)

Merging data sets using macro code/ Macro for merging datasets

 / Published in: SAS


Merging the data sets with a common variable if the datasets has the same prefix name?

For example: col1-col10 dsn1-dsn 7 data1 to data6 with common variable of Usubjid.

  1. here is the example, I have 7 datasets i need to merge and each of them having the common variable(usubjid) to merge, and all the datasets having the same prefix dsn(dsn1 to dsn7).
  3. %macro allmerge (n);
  4. data combine;
  5. merge %do i = 1 % to &n;
  6. dsn&i;
  7. %end;
  8. by usubjid;
  9. run;
  10. %mend;
  11. %allmerge (7)
  13. Sarath

Report this snippet  

You need to login to post a comment.