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 1996, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 2 Apr 1996 15:40:14 -0600
Reply-To:     /PN=ROBERT.DAVIS/OU=AEDC21/@SMTPGATE.ARNOLD.AF.MIL
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         "Robert F. Davis"
              </PN=ROBERT.DAVIS/OU=AEDC21/@SMTPGATE.ARNOLD.AF.MIL>
Subject:      Re: arrays in Macro

Subject: array in a macro Abdu: Arrays can not be used in macro. They are data step statements. Try the following code, I think it will do what you want.

%let count=; %let varl = a b c d ; *list of variable names ;

%macro test; %do %while (%scan(&varl,%eval(&count+1)) ne %str()); %let count=%eval(&count+1); %let vname=%scan(&varl,%eval(&count)); %test2(&vname); **test2 is another macro I want to call here; %end test;

%mend;

%macro test2(name); %put &name; data _null_; set x; put &name; %mend test2;

data x; a=1; b=2; c=3; d=4; run;

%test; run; quit;

------------------------------- Message Contents ------------------------------- >Hello SAS-Lers: >I have a question and will appreciate your response; I have a macrothat >looks something like this (not exactly): >********************************************; > >%let varl list of variable names ; >%Macro test; > %do i=1 %to dim(varn); > %let vname=varn(&i); > %test2(&vname); **test2 is another macro I want to call here; > %end; >%mend; >********************************************; > >It does NOT work. Anything wrong? Your comments and SUGGESTIONS forbetter >one will be appreciated. Thanks in advance for your help. > >Abdu

Robert F. Davis Sverdrup Technology, Inc Arnold Air Force Base, TN. davisrf@hap.arnold.af.mil


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