LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 2010, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 15 Jan 2010 19:11:25 +0100
Reply-To:     Daniel Fernández <fdezdan@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Daniel Fernández <fdezdan@GMAIL.COM>
Subject:      Re: 'IN' in macros
Comments: To: Nathaniel Wooding <nathaniel.wooding@dom.com>
In-Reply-To:  <966B4B225F74914599E617416969BF1A460B011DAF@DOM-MBX02.mbu.ad.dominionnet.com>
Content-Type: text/plain; charset=ISO-8859-1

hi,

because I have not 9.2 version and I am a bit lazy for macros:

%macro in_condition; in(1,2,3) %mend; data need; set test; if a %in_condition then b=a ; else b=a+1; run;

Daniel Fernandez Barcelona.

2010/1/15 Nathaniel Wooding <nathaniel.wooding@dom.com>: > 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. >


Back to: Top of message | Previous page | Main SAS-L page