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 (August 2003, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 6 Aug 2003 10:54:35 -0400
Reply-To:     Huck <huck@FINN.NOSPAM.MOC>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Huck <huck@FINN.NOSPAM.MOC>
Organization: Posted via Supernews, http://www.supernews.com
Subject:      Re: Question on Macros...
Content-Type: text/plain; charset=us-ascii

On 6 Aug 2003 07:02:33 -0700, mvatyam@household.com (Manik) wrote:

>Following is the progran, i am working on. I wrote a SQL expression in >macro and calling that macro as follows... > >I am passing WHERE condition "ACCT_STATUS='C'" to SELECT statement in >macro ADD_ROW_COND using variable VAR_WHERE.. i got the following >error.. > >----------- >ERROR: The keyword parameter ACCT_STATUS was not defined with the >macro. > > >I tried pass the condition as a string >%LET VAR1 = %STR(ACCT_STATUS = %'C%'); and i passed &VAR to VAR_WHERE >in macro.. i gotthe following error >67 ACCT_STATUS = 'C' > _ > _ > _ > 22

>ERROR 22-322: Syntax error, expecting one of the following: a name, a >quoted str

A QUOTED STRING??? aint that whats there?

when the error looks real strange the strange suspect QUOTEING

%LET VAR1 = %STR(ACCT_STATUS = %'C%'); %let var1=%unquote(&var1); /* ok since the quotes are matched */

another common problem i run in to all the time... it may look like a quote on the log, but what the sas parser saw was not a quote.

>ing, a numeric constant, a datetime constant, a missing value, (, *, >+, -, ALL, ANY, BTRIM, CALCULATED, CASE, INPUT, LOWER, PUT, SELECT, >SOME, SUBSTRING, >TRANSLATE, UPPER, USER. >--------------- > > >Could you please have allok and let me know, where i am doing >wrong..... >Thanks in advance...... > > >********** >DATA ACTIVE1; >INFILE HFCBEN; >INPUT > @169 ACCT_STATUS $CHAR1. >RUN; > > %MACRO CREATE_TBL(TABLE_NAME); > PROC SQL ; > CREATE TABLE &TABLE_NAME > ( COL_NAME CHAR(20), > COL_DESC CHAR(50), > COL_VALUE NUM ); > QUIT; > %MEND CREATE_TBL; >%MACRO ADD_ROW_COND(TBL_NAME,VAR_NAME,VAR_SELECT, > VAR_DESC, > VAR_WHERE); > %PUT "VAR SELECT : " &VAR_SELECT; > %PUT "VAR WHERE : " &VAR_WHERE; > PROC SQL ; > INSERT INTO &TBL_NAME > SET COL_NAME = "&VAR_NAME", > COL_DESC = "&VAR_DESC", > COL_VALUE = > ( SELECT &VAR_SELECT > FROM ACTIVE1 > WHERE &VAR_WHERE); >QUIT; >%MEND ADD_RO%CREATE_TBL(MNXCE); > >%CREATE_TBL(MNXCE); >%ADD_ROW_COND(MNXCE,TOT_OPEN_ACCTS,COUNT(*), > NUMBER OF OPEN/ACTIVE ACCOUNTS, > ACCT_STATUS='C'); >***************


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