Date: Thu, 12 Feb 2004 21:56:10 -0500
Reply-To: richard@glencairn-consulting.com
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Richard Graham <richard@GLENCAIRN-CONSULTING.COM>
Organization: Glencairn Consulting Group
Subject: Re: Again hyphen problem, but in other way
In-Reply-To: <200402130112.i1D1CpA28052@listserv.cc.uga.edu>
Content-Type: text/plain; charset="us-ascii"
Anbu,
I see four problems....
1. your macro has TWO parameters colvalue and colname
your second macro call %category(Pacific-Islanders) only provides 1
parameter
so when the macro is invoked the where clause will basically be ignored
because you are not providing a variable on which the where clause could
evaluate a value.
2. you need a semi-colon at the end of your %macro category....
3. the Pacific-Islanders is an ILLEGAL data set name, hyphen is not
allowed in the data set name
4. your WHERE statement has &colVaue it should be &colValue
hth
Richard W. Graham
Vice President
Glencairn Consulting Group
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.VT.EDU] On Behalf Of Anbu
Arasu
Sent: Thursday, February 12, 2004 8:13 PM
To: SAS-L@LISTSERV.VT.EDU
Subject: Again hyphen problem, but in other way
I have a program like this.
%macro category(colvalue,colName)
data demo.&colValue(DROP =percent freq percent1);
set dataset1;
where &colname="&colVaue";
freq=put(count,z1.0);
percent1=put(percent,z4.2);
percentcount=freq || '(' || percent1 || '%)';
run;
%mend category;
%category(Asian, Race);
%category(Pacific-Islanders);
For %category(Asian, Race) call it works perfectly.
For %category(Pacific-Islanders) log says
SYMBOLGEN: Macro variable COLVALUE resolves to Pacific-Islanders
NOTE : Line generated by the invoked macro "CATEGORY".
data demo.abc(DROP =percent freq percent1);
Error pointing to freq saying " Expecting Arithmetic operator".
And another error is pointing to hyphen in
demo.Pacific-Islanders
ERROR: undeclared array referenced : Islanders
I just typed those errors. Please help me.
Thanks,
Anbu