Date: Tue, 20 Mar 2001 15:07:10 -0500
Reply-To: "Fehd, Ronald J." <rjf2@CDC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Fehd, Ronald J." <rjf2@CDC.GOV>
Subject: Re: ERROR 22-322: Syntax error, expecting: a name, #, +, @.
Content-Type: text/plain; charset="iso-8859-1"
#1 set these options and rerun the program so we can see where the error
occured
options mprint nomacrogen nosymbolgen;
in the meantime consider that you may think you are writing SAS put
statements with your macro code, but your log shows that you are in fact
writing macro notes to the log:
>%put @&mm D01G00&j @;
yields this:
> @1785 D01G219 @
I see by the fact that you are using a trailing at sign (@) that you think
you have held the output line until some other put statements are generated.
according to my comment above -- using <%put> instead of <put> --
I suspect that your error is because you do not have a closing put for the
held line.
insert
put;
before this line:
> run;
> %mend dummymac;
summary:
#1 provide log using only option mprint
#2 macro code is not writting SAS statements
#3 close held output line
Ron Fehd the macro maven CDC Atlanta GA USA RJF2@cdc.gov
OpSys: WinNT Ver: 8.1
---> cheerful provider of UNTESTED SAS code!*! <---
e-mail your SAS improvements to: suggest@sas.com
archives: http://www.listserv.uga.edu/archives/sas-l.html
By using your intelligence you can sometimes make your problems twice as
complicated.
-- Ashleigh Brilliant
remember perspective: the error is not always where it seems to occur! --
RJF2
> -----Original Message-----
> From: Aldi Kraja [mailto:aldi@WUBIOS.WUSTL.EDU]
> Sent: Tuesday, March 20, 2001 2:32 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: ERROR 22-322: Syntax error, expecting: a name, #, +, @.
>
>
> Hi,
>
> Following are provided a part of a program and a part of the log. SAS
> sees an ERROR:
>
> ERROR 22-322: Syntax error, expecting one of the following: a name, #,
> +, @.
>
> which it is not clear for me in this moment why.
>
> Any suggestion is appreciated,
> Aldi
>
> P.S. This part of the program is preparing all possible variables and
> creating
> a file (ASCII) with one line that has mainly the names of the
> variables
> present in other data sets.
> "lf" and "mm" stand for the positions where the name of the variables
> will be positioned.
>
> =========================Partial Program:=============================
> /* work on preparing the header file */
> %let lengcol=8;
> %let sex=sex;
> %let age=age;
> %let Q5=Q5;
> %let nmark=220;
>
>
> filename head "/data/aldi/header.dat";
>
> data _null_;
> file head mod lrecl=32767;
> total=input(&TotVar,3.);
> lf1=4-length(compress(total))+1;
> lf2=8;
> lf3=8*1+1;
> lf4=8*2+1;
> lf5=8*3+1;
> put @lf1 &TotVar @lf2 &lengcol @lf3 "&sex" @lf4 "&age" @lf5
> "&Q5" @;
>
> %do j=1 %to &nmark;
> %let mm=%eval((&j+4)*8+1);
>
> %if &j<220 %then %do;
> %if &j<10 %then %do;
>
> %put @&mm D01G00&j @;
> %end;
> %else %if &j<100 %then %do;
>
> %put @&mm D01G0&j @;
> %end;
> %else %do;
>
> %put @&mm D01G&j @;
> %end;
> %end;
> %else %if &j=220 %then %do;
>
> %put @&mm D01G&j ;
>
> %end;
> %end;
> run;
>
> %mend dummymac;
>
>
> ==========================Partial LOG:==============================
> SYMBOLGEN: Macro variable J resolves to 219
> @1785 D01G219 @
> MLOGIC(DUMMYMAC): %DO loop index variable J is now 220; loop will
> iterate again.
> MLOGIC(DUMMYMAC): %LET (variable name is MM)
> SYMBOLGEN: Macro variable J resolves to 220
> SYMBOLGEN: Macro variable J resolves to 220
> MLOGIC(DUMMYMAC): %IF condition &j<220 is FALSE
> SYMBOLGEN: Macro variable J resolves to 220
> MLOGIC(DUMMYMAC): %IF condition &j=220 is TRUE
> MLOGIC(DUMMYMAC): %PUT @&mm D01G&j
> SYMBOLGEN: Macro variable MM resolves to 1793
> SYMBOLGEN: Macro variable J resolves to 220
> @1793 D01G220
> MLOGIC(DUMMYMAC): %DO loop index variable J is now 221; loop will not
> iterate again.
> MPRINT(DUMMYMAC): run;
>
> ERROR 22-322: Syntax error, expecting one of the following: a name, #,
> +, @.
>
> NOTE: Numeric values have been converted to character values at the
> places given by: (Line):(Column).
> 143:169 143:10
> NOTE: The SAS System stopped processing this step because of errors.
> NOTE: DATA statement used:
> real time 2.23 seconds
> cpu time 0.91 seconds
>
>
>
> --
>
|