BookmarkSubscribeRSS Feed
Bill
Quartz | Level 8
The first macro pgm does not work in SAS 9.1.3. An alternative is to use the second one, however, I'd rather not repeat the "proc print data=test;run;" section since it's actually very long in my pgm. Perhaps I'm having a brain cramp, but I haven't been able to come up with an alternative. Can someone help? (&runflg comes in from another part of the pgm). Thanks, Bill

%macro report; %*First;

%if &runflg in 1,5 %then %do;
proc print
data=test;
run;
%end;

%mend report;
%report;



%macro report;%*Second;


%if &runflg = 1 %then %do;
proc print data=test;
run;
%end;

%else %if &runflg = 5 %then %do;
proc print data=test;
run;
%end;

%mend report;
%report; changed %runflg to &runflg

Message was edited by: Bill
5 REPLIES 5
Peter_C
Rhodochrosite | Level 12
of course the OR logic would provide a substitute for IN
However, IN should be working..... if you set system option different from the default NOmInOperator 😉
Try
%put abc = %eval( 1 in 1 2 3 ) ;
%put def = %eval( 1 in 1,2, 3 ) ;

If you want to use a comma separator for the IN list, then set option mInDeliminator

Good Luck
PeterC
deleted_user
Not applicable
sorry,
that last posting was using options from SAS9.2
which introduces the IN operator to the SAS Macro language.

For SAS 9.1.3 you need to create your own, or use OR, like [pre]
%if &runflg = 1 OR &runflg =5 %then %do;
[/pre]
Good Luck

PeterC
Bill
Quartz | Level 8
Thank you Peter.

How odd (to me at least) that it's not %OR.

wd
deleted_user
Not applicable
Hi,
i tried to use IN but it does not work (lvl 9.1.3) and reading you messages it works from 9.2 explains a lot
BUT read the sas help: http://support.sas.com/onlinedoc/913/getDoc/nl/mcrolref.hlp/a002475219.htm

Here it says it should work from level 9 !!!

GreetZ,
Herman
LinusH
Tourmaline | Level 20
Here's the explanation for that:

http://support.sas.com/kb/11/945.html

/Linus
Data never sleeps

sas-innovate-2024.png

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.

 

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
  • 5 replies
  • 870 views
  • 0 likes
  • 4 in conversation