BookmarkSubscribeRSS Feed
Q1983
Lapis Lazuli | Level 10

%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

1 REPLY 1
ballardw
Super User

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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 918 views
  • 0 likes
  • 2 in conversation