Date: Fri, 15 Jan 2010 11:47:26 -0500
Reply-To: Nathaniel Wooding <nathaniel.wooding@DOM.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Nathaniel Wooding <nathaniel.wooding@DOM.COM>
Subject: Re: 'IN' in macros
In-Reply-To: <95b101341001150646t52a3de15w6c7caa45420631b1@mail.gmail.com>
Content-Type: text/plain; charset="us-ascii"
From a Birdie (I.e., SAS Institute staff)
See http://support.sas.com/kb/35/591.html
Nat Wooding
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of sas biology
Sent: Friday, January 15, 2010 9:46 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: 'IN' in macros
Hello All,
How can I do this using Macros?
if a *in* (1 2 3) then b=a;
else b=a=1;
I can think of doing it in macros this way:
%if *&a=1 or &a=2 or &a=3* %then %do;
b=&a;
%end;
%else %do;
b=%eval(&a+1);
%end;
I am sure there must be a better way of doing it. Can someone spend some
time on this?
I specifically want to know how to avoid using 'OR' as in *&a=1 or &a=2 or
&a=3* and how to do it in a simple way.
**
Thanks
SB
CONFIDENTIALITY NOTICE: This electronic message contains
information which may be legally confidential and or privileged and
does not in any case represent a firm ENERGY COMMODITY bid or offer
relating thereto which binds the sender without an additional
express written confirmation to that effect. The information is
intended solely for the individual or entity named above and access
by anyone else is unauthorized. If you are not the intended
recipient, any disclosure, copying, distribution, or use of the
contents of this information is prohibited and may be unlawful. If
you have received this electronic transmission in error, please
reply immediately to the sender that you have received the message
in error, and delete it. Thank you.