Hello,
I am working within proc report and have a macro that sends out the output depending on which group I call. Each group has different column headers, however I have 5 groups that have the same headers.
For example (portion of code):
%if &nbr. =1 %then %do;
ods listing close;
ods tagsets.rtf file = "&&outpath&nbr" &repopt;
title3 "&&ttlnum&nbr";
title4 "&ttldesc";
title5 "&&ttlpop&nbr";
title6 "Part 1 of 2";
proc report data = final&pop headline headskip nowindows missing split = "@"
style = [protectspecialchars = off] style(report) = [bordertopwidth = 1.5] spanrows;
columns brk ptord aedecod text _1 ("Bupivacaine HCl &ulspan" _2 _3 _4 _98) sp ("HTX-011 &ulspan" _99);
....
%end;
I there a way to change
%if &nbr. =1 %then %do.....to something like this>
%if &nbr. in (1 2 3 4 5) %then %do ((OF COURSE THIS NOT WORKING))
So when I call macro
example: %rept (1,POP1);%rept (2,POP2); %rept (3,POP3);%rept (4,POP4);%rept (5,POP5)...they will all use all use the same report columns.
Thank you!
You can use OR conditions in macro IF statements:
%if &nbr. = 1 %or &nbr. = 2 %or &nbr. = 3 %or &nbr. = 4 %or &nbr. = 5 %then %do;
You can use OR conditions in macro IF statements:
%if &nbr. = 1 %or &nbr. = 2 %or &nbr. = 3 %or &nbr. = 4 %or &nbr. = 5 %then %do;
To get your macro version of the IN operator to work, you need to turn on the MINOPERATOR option, and set the MINDELIMITER option to be a space in the %MACRO statement.
%macro rept( )/minoperator mindelimiter=' ';
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.
Ready to level-up your skills? Choose your own adventure.