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 2008, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 25 Feb 2008 15:50:34 -0500
Reply-To:     "Fehd, Ronald J. (CDC/CCHIS/NCPHI)" <rjf2@CDC.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Fehd, Ronald J. (CDC/CCHIS/NCPHI)" <rjf2@CDC.GOV>
Subject:      Re: "IN" Operator in Macro Code
In-Reply-To:  <04578df5-f094-434f-b90f-0a7a669df79c@m23g2000hsc.googlegroups.com>
Content-Type: text/plain; charset=us-ascii

> From: plw213

> I am trying to use the IN operator in macro code, but cannot get it to > work. the code look like this: > > %if &RptMBS2 # Middle Key %then %do ; > . > . > %end; > > > The Log issues the following error: > ERROR: A character operand was found in the %EVAL function or %IF > condition where a numeric operand is required. The condition was: > &RptMBS2 # Middle Key > > All I am trying to do is check for the condition that the Character > value of &RptMBS2 is either 'Middle' or 'Key'. > > Anyone know why this doesn't work?

too much code was broken for users who had pound sign in their testing cases so the macro operator in :: # was disabled.

look for this in v9.2, maybe

in the meantime, this trick may work:

If %index(&RptMBS2.,Middle) or %index(&RptMBS2.,Key) %then %do;

defensive programmers might want to %upcase both arguments

If %index(%upcase(&RptMBS2.),MIDDLE) or %index(%upcase(&RptMBS2.),KEY) %then %do;

Ron Fehd the macro maven CDC Atlanta GA USA RJF2 at cdc dot gov


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