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 (September 2006, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 1 Sep 2006 10:23:47 -0400
Reply-To:   Jim Groeneveld <jim2stat@YAHOO.CO.UK>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Jim Groeneveld <jim2stat@YAHOO.CO.UK>
Subject:   Re: Using the IN operator in %IF statement
Comments:   To: Jack Clark <JClark@CHPDM.UMBC.EDU>

Hi Jack,

For a solution see http://tinyurl.com/lot89

Regards - Jim. -- Jim Groeneveld, Netherlands Statistician, SAS consultant home.hccnet.nl/jim.groeneveld

On Fri, 1 Sep 2006 10:03:56 -0400, Jack Clark <JClark@CHPDM.UMBC.EDU> wrote:

>Good morning everyone. > > > >I am creating a new macro variable called NEEDC. If the last word in the >formatted value of another macro variable (&WHCL) is 'City', 'State' or >'County', I want the value of NEEDC to be blank. Otherwise I want the value >of NEEDC to be the word County; > > > >I have successfully tested and run the code below, simply checking for the >word 'City' as the last word in the formatted &WHCL: > > > >%if %qscan( %bquote(%sysfunc(putc(&whcl,$cnty.))),-1,%str( ) ) = City % then >%do; > > %let needc =; > >%end; > >%else %do; > > %let needc = County; > >%end; > > > > > >When I tried to use the IN operator to check for 'City', 'State' or >'County', I am getting an error message in the log that says "Required >operator not found in expression". I have tried it with and without quotes >around the City, State and County : > > > >%if %qscan( %bquote(%sysfunc(putc(&whcl,$cnty.))) ,-1,%str( ) ) in >(City,State,County) %then %do; > > %let needc =; > >%end; > >%else %do; > > %let needc = County; > >%end; > > > > > >I am not sure if this is related to the use of the IN operator in macro >code, or if there is a macro quoting problem with the three terms in the >parentheses. Can someone please give me some direction on this? I am >interested in a solution to make the code work, as well as an explanation as >to why my existing code is not valid. > > > >Thank you. > > > > > >Jack Clark > >Research Analyst > >Center for Health Program Development and Management > >University of Maryland, Baltimore County


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