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 (April 2004, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 26 Apr 2004 08:23:02 -0400
Reply-To:     Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Subject:      Re: error in a macro

You do not have an error in a macro because you do not have a macro. A macro begins with "%macro" and ends with "%mend".

You are trying to use global macro variables, however. You should stop doing so until (1) you understand their nature and purpose and (2) there is an indication that they are needed to solve the problem, or at least that they provide some significant advantage. At this point I don't think either condition holds.

Look for a solution using only DATA step code (no percent signs).

On Sun, 25 Apr 2004 23:43:27 -0400, Mayukh Dass <dass@UGA.EDU> wrote:

>Hi, > >I am trying to calculate sum of variables desc3, desc6, desc9, desc12, >desc15. Initially, these variables are read as strings. > >%let course_no=5; >%let attr_no=3; >%let vars_no=%eval(&course_no*&attr_no); >%let filename=rec3.dat; > >data two; > infile "C:\Documents and Settings\Mayukh Dass\My >Documents\iFolder\6360\&filename" missover; > input name$ (desc1-desc&vars_no)($); > do n=3 to 16 by 3; > tothr=tothr+input(&&desc&n, 1.); > end; > run; >proc print; >run; > > >but the following error is occuring: > >134 %let course_no=5; >135 %let attr_no=3; >136 %let vars_no=%eval(&course_no*&attr_no); >137 %let filename=rec3.dat; >138 >139 data two; >140 infile "C:\Documents and Settings\Mayukh Dass\My >Documents\iFolder\6360\&filename" missover >140! ; >141 input name$ (desc1-desc&vars_no)($); >142 do n=3 to 16 by 3; >143 tothr=tothr+input(&&desc&n, 1.); >WARNING: Apparent symbolic reference N not resolved. >NOTE: Line generated by the macro variable "N". >1 &desc& > - > 22 >WARNING: Apparent symbolic reference DESC not resolved. >WARNING: Apparent symbolic reference N not resolved. >ERROR 22-322: Syntax error, expecting one of the following: a name, a >quoted string, > a numeric constant, a datetime constant, a missing value, >INPUT, PUT. > >144 end; >145 run; > >NOTE: Character values have been converted to numeric values at the >places given by: > (Line):(Column). > <no line/column information available> >NOTE: Numeric values have been converted to character values at the >places given by: > (Line):(Column). > 1:6 >NOTE: The SAS System stopped processing this step because of errors. >WARNING: The data set WORK.TWO may be incomplete. When this step was >stopped there were 0 > observations and 18 variables. >WARNING: Data set WORK.TWO was not replaced because this step was >stopped. >NOTE: DATA statement used: > real time 0.01 seconds > cpu time 0.00 seconds > > >146 proc print; >147 run; > >NOTE: No observations in data set WORK.TWO. >NOTE: PROCEDURE PRINT used: > real time 0.01 seconds > cpu time 0.00 seconds > > > >Would you please tell me where I am making the mistake? > >Regards, >Mayukh


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