Help using Base SAS procedures

Need Help on Macro Coding

Reply
N/A
Posts: 0

Need Help on Macro Coding

I created these &VARS &FILEN1 - &FILEN9 in a DATA Step as follows;


DATA _NULL_;
RETAIN NUMCSV 0;
INFILE INP LENGTH=ILEN;
INPUT DIRLINE $VARYING100. ILEN;
NUMCSV = NUMCSV + 1;
FILEN = COMPRESS("FILEN" || PUT(NUMCSV,2.));
CALL SYMPUT(FILEN,DIRLINE);
CALL SYMPUT("NUMCSV",NUMCSV);
RUN;

And now I want to process each in a %MACRO %DO LOOP changing the x in the following &FILENx from 1 to 9.

%DO I = 1 %TO &NUMCSV;
...
FILENAME WINPERF "&FILENx";
...
%END;

Can anyone point me in the right direction?
SAS Super FREQ
Posts: 8,868

Re: Need Help on Macro Coding

Posted in reply to deleted_user
Hi:
There are some suggestions and references in this previous forum posting:
http://support.sas.com/forums/thread.jspa?threadID=9640&tstart=0

cynthia
N/A
Posts: 0

Re: Need Help on Macro Coding

Posted in reply to Cynthia_sas
The info I found and needed was that the "I" counter variable in the
%DO I=1 TO ... is referenced as "&I" when in the %MACRO and to suffix it to the other AmperVar &FILEN I needed to code 2 ampersands &&FILEN&I. Thank You
Super Contributor
Super Contributor
Posts: 3,174

Re: Need Help on Macro Coding

Posted in reply to deleted_user
Very useful links using the Google advanced search arguments below, this topic/post:

macro variable introduction site:sas.com

macro variable generate code site:sas.com


Scott Barry
SBBWorks, Inc.
Ask a Question
Discussion stats
  • 3 replies
  • 110 views
  • 0 likes
  • 3 in conversation