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