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 (February 2010, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 9 Feb 2010 01:44:39 -0800
Reply-To:     Amar Mundankar <amarmundankar@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Amar Mundankar <amarmundankar@GMAIL.COM>
Organization: http://groups.google.com
Subject:      Re: How to use IN operator in %if condition (i.e. inside Macro)
              in SAS 9.1.3
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset=ISO-8859-1

On Feb 9, 1:20 pm, Amar Mundankar <amarmundan...@gmail.com> wrote: > Hi all, > How can we use the IN operator for %if condition inside a macro ?? > I am using SAS 9.1.3. > I tried to use # , but it didnt work. what can be the problem ?? > It is throwing an error as : > > 67 data temp; > 68 do i = 1 to 2; > 69 %mymac(one=on); > MLOGIC(MYMAC): Beginning execution. > MLOGIC(MYMAC): Parameter ONE has value on > SYMBOLGEN: Macro variable ONE resolves to on > SYMBOLGEN: Macro variable GRP resolves to ('on', 'off') > ERROR: Required operator not found in expression: &one # &grp > ERROR: The macro MYMAC will stop executing. > MLOGIC(MYMAC): Ending execution. > 70 end; > 71 run; > > Please help. > > Code: > > %macro mymac(one=on); > %if &one # &grp %then %do ; > %put condition true; > %end; > %else %do; > %put condition false; > %end; > %mend; > > data temp; > do i = 1 to 2; > %mymac(one=on); > end; > run; > > Regards, > Amar Mundankar.

i forgot to paste %let statement.

Updated code :

%let grp = ('on', 'off');

%macro mymac(one=on); %if &one # &grp %then %do ; %put condition true; %end; %else %do; %put condition false; %end; %mend;

data temp; do i = 1 to 2; %mymac(one=on); end; run;

Regards, Amar Mundankar.


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