BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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?
3 REPLIES 3
Cynthia_sas
Diamond | Level 26
Hi:
There are some suggestions and references in this previous forum posting:
http://support.sas.com/forums/thread.jspa?threadID=9640&tstart=0

cynthia
deleted_user
Not applicable
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
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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.
What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1225 views
  • 0 likes
  • 3 in conversation