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