1         Macro



1.1       Re-use existing macro



/*say you have two macros under such direction*/


filename test 'J:\OCC_DATA\Zunqiu(Eric)\SAS macro\sas Code';

filename sample 'J:\OCC_DATA\Zunqiu(Eric)\SAS macro\sas Code';


options mautosource mautolocdisplay sasautos=(test sample  sasautos);



proc options option=sasautos;run;


libname books "J:\OCC_DATA\Zunqiu(Eric)\SAS macro\dataset";



/* here is the two macros code: test and sample*/

/*Test.sas is the macro name*/

%macro test;

            %put hello;



/*sample.sas is another macro name*/

%macro sample(dsname);

%if %sysfunc(exist(&dsname)) %then %do;

proc print data=&dsname(obs=10);

title "First 10 Observations of &dsname";



%else %put ERROR: ***** Data set &dsname does not exist.;

%mend sample;