Return to Homepage

Goto the Tip of the Month Archive

Other interesting pages ...
LinkedIn Profile
SAS Cheat Sheet
Useful SAS Code
Full SAS Example
Basic Statistics
Contact Information

SAS Tip of the Month
February 2014
(for SAS and WPS)

When we bring in multiple sets of data with a common ID, for example PATIENT_ID, sometimes we want to subset the data to a particular set of IDs. Rather than writing the same WHERE or IF statement multiple times there are a few techniques for writing it just once -- this allows for easy changes to the list of section as it only has to be changed once. See below for a code example:

   %macro subsel;
      where PATIENT_ID in('001','002','005')
   %mend subsel;

   proc print data=demog;
      %subsel;
   run;
   proc print data=ae;
      %subsel;
   run;

Hope this is useful. See you next month.

________________________________
Updated February 2, 2014