%macro trial(investor,type);
ODS TAGSETs.ExcelXP
options(sheet_interval='Table' sheet_name="&investor &type" center_horizontal="yes"
fittopage="No" blackandwhite="Yes" Embedded_Footnotes='Yes' Embedded_Titles='Yes'
autofit_height='Yes' orientation='landscape' absolute_column_width='7' Frozen_Headers='3');
proc report data=trial4 wrap style(column)={JUST=CENTER};
where investor = "&investor" and type = "&type";
columns LN_NO investor LM_TEMPLATE_NM s323_dt;
title justify=left "Report as of &rpt_dt";
FOOTNOTE1 justify=Left Height=8pt "&FNote1";
FOOTNOTE2 justify=Left Height=8pt "&FNote2";
RUN;
%mend;
%trial(FHA,IN TRIAL);
%trial(FHA,TRIAL ON STREET);
%trial(FHLMC,IN TRIAL);
%trial(FHLMC,TRIAL ON STREET);
%trial(FNMA,IN TRIAL);
%trial(FNMA,TRIAL ON STREET);
%trial(PRIVATE / REG AB,IN TRIAL);
%trial(PRIVATE / REG AB,TRIAL ON STREET);
For this report output the investor represents the example (ie FHA,FHLMC) and the Type is represented by examples (IN TRIAL or TRIAL ON STREET). Since this passes a macro and puts each in a separate tab based on the investor I want to show the s323_dt only if the Investor = ‘FHA’, not the others. I know I could create t separate dataset just for FHA however I want to handle this within the macro
columns LN_NO investor LM_TEMPLATE_NM
%if %upcase(&investor) = FHA %then s323_dt;
;
Note that there is NO ; on the line starting with "columns"
and the "extra" ; is actually there to close the statement starting with columns.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.