/* This is an example of a simple macro that can pass parameters very similar to subroutines in other languages. What's referenced at the beginning of the macro is referred to in the program by using an ampersand (&) character. The macro uses this unique character to subtitute the text you requested in the programming code; */ *First we read in a test data set for you; data mydata; input Y VAR1 VAR2 VAR3; cards; 1 10 33 4 0 20 21 3 1 30 59 2 1 20 76 1 0 . 24 3 0 20 . 2 1 10 28 2 1 10 49 2 0 30 76 . 1 20 59 2 ; *Macro passes the Title and the number of observations to be printed; %macro test(mytitle,mynumber); title &mytitle; proc print data=mydata (obs=&mynumber); run; %mend test; *Now we call the macro 3 times..; %test(My First Title,8); %test(My Second Title,6); %test(My Third Title,1);