Date: Tue, 8 Jan 2008 11:43:06 -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: Macro Error
In-Reply-To: <5ed40497-d212-4d2a-b9b6-fc2b1e0c1519@e10g2000prf.googlegroups.com>
Content-Type: text/plain; charset=us-ascii
> From: sasuser
> I am new to using the macros in sas.
>
> Below is my requirement, code and error. Please take a look at it and
> let me know where i was wrong. If possible, please provide me the
> correct code.
>
> REQUIREMENTS:
> ----------------------------
> VARIABLES REQUIRED: var1:dtt=1; test=TS; AP=AM; NP=PRR
>
> MACRO CODE:
> -------------------------
> %MACRO TABLES(var1=, TEST=, ap=, np=);
>
> proc sort data=d;
> by pt;
> where &var1 and test="&tests" and ap="&apcat" and np="&npcat";
you need to use the exact spellings of your macro parameters
and placing the where statement as a data set option is better.
proc sort data = d
(where = ( &var1.
and test = "&test."
and ap = "&ap."
and np = "&np."));
by pt;
> run;
> ------- In between the code i created 3 macros which are running good.
> *%MEND TABLES;
this
%TABLES(var1=DTT=1,tests=TS,&apcat=AM,&npcat=PRR);
should be this: () replace equals sign (=) with equals mnemonic (eq)
%TABLES(var1 = DTT eq 1
,test = TS
,ap = AM
,np = PRR);
Your errors says that no macro variable parameters exist with those
names.
> ERROR:
> -------------
> WARNING: Apparent symbolic reference VAR1 not resolved.
> WARNING: Apparent symbolic reference TESTS not resolved.
> WARNING: Apparent symbolic reference APCAT not resolved.
> WARNING: Apparent symbolic reference NPCAT not resolved.
> ERROR: Syntax error while parsing WHERE clause.
Ron Fehd the macro maven CDC Atlanta GA USA RJF2 at cdc dot gov