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 (November 2004, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 23 Nov 2004 09:51:10 -0500
Reply-To:   Fred <>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Fred <ieaggie2002@GMAIL.COM>
Subject:   Why macro thinks DIM function is a character operator?
Content-Type:   text/plain; charset=US-ASCII

Hi, all I use Macro to do loop computation, which involves the dimension of an existing data set. However, I cannot get it run, since there were messages as below:

PROC IMPORT DATAFILE = 'test.txt' OUT = TEST DBMS = TAB REPLACE; RUN; PROC SQL NOPRINT; SELECT name INTO:num_list separated BY " " FROM dictionary.columns WHERE libname="WORK" AND memname="TEST" AND TYPE = "num"; Quit;

%LET nef=DIM(&num_list);

%MACRO LaggedEF; %local i; %local j; DATA LagedEF; SET test; nlag = 2; ARRAY AT{*} &num_list; ARRAY AT1{*} EF1-EF%eval(nlag*nef); %DO i=1 %TO nef AT1(&i) = AT(&i); %END; %DO j = 1 %TO nlag; %DO i=1 %TO nef; AT1(&j*nef+i) = lag(AT1((&j-1)*nef+&i)); %END; %END; RUN; %MEND LaggedEF; %LaggedEF; ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: nlag*nef ERROR: Missing numeric suffix on a numbered variable list (EF1-EF). WARNING: Defining an array with zero elements. ERROR: The macro LAGGEDEF will stop executing. RUN;

I think "nef" is already a numerical value before the macro definiton. Why macro does not recognize it?

Please give me a hand on this. Thanks for your point.


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