/*CALL SYMPUT*/ /*read a piece of information from a SAS data and use that information as part of the macro process--instead of a user providing it manually.*/ proc means data=sashelp.class max min mean ; var height; ods output summary=RL; run; /*read information off a SAS data set and store the information as a macro*/ data RL;set RL; call symput ("height_Max", height_Max); call symput ("height_Min", height_Min); call symput ("height_Mean", height_Mean); run; /*now the stored information can be used as macros*/ data RL;set RL; notes="Tallest &height_max ; Mean &height_mean ; Shortest &height_Min"; run; proc print data=RL; var notes; run; /*Also let SAS make a decision about what to do based on macro information*/ /*if there is a person taller than 70 in the data set, do this process*/ /*when you use %if type of statement, the whole thing has to occur in a macro statement. This is why I have macro ABC wrapp the whole process.*/ %macro ABC;/*the whole thing has to be wrapped in a macro*/ %if %sysevalf(&height_max > 70) %then %do; data asdf; X="There is a person taller than 70 in the data"; run; proc print;run; %end; %mend ABC;/*this is the end of a macro*/ %ABC;/*excecute the macro just writtn above*/ %macro ABC2; /*if nobody is taller than 70 in this data set, do this process*/ %if %sysevalf(&height_max < 70) %then %do; data asdf; X="There is nobody taller than 70 in the data"; run; proc print;run; %end; %mend ABC2; %ABC2;