The SAS Output Delivery System and reporting techniques

Conditional display of variables in macro based output ODS

Reply
Frequent Contributor
Posts: 123

Conditional display of variables in macro based output ODS

%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

Grand Advisor
Posts: 9,748

Re: Conditional display of variables in macro based output ODS

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.

Post a Question
Discussion Stats
  • 1 reply
  • 379 views
  • 0 likes
  • 2 in conversation