Date: Sun, 11 Jan 1998 06:24:06 GMT
Reply-To: Ashok Natarajan <anataraj@UCI.EDU>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Ashok Natarajan <anataraj@UCI.EDU>
Organization: University of California, Irvine
Subject: Re: Help with Macro
Thanks to Anthony Ayiomamitis and Roland Rashleigh-Berry, I think I am
making progress in understanding how macros work. However, I confused
myself while writing my previous message, and am still having
problems.
While I had indicated that the regressor variables were x1-x50, they
really are a little more descriptive, and have variable labels. The
macro was supposed to retain the variable name and label value, which
is why I had an array defined for the 50 variables.
It is relatively easy to rename the variables and use Anthony's
solution, and this in fact works, but I can't differentiate between x1
"a super important variable" and x50 "a minor unimportant variable".
So let me define the problem again, hopefully a little more clearly
this time.
data a ;
infile 'a.dat' ;
input y abc1 def2 ghi3 ........ xyz50 ;
label abc1 = "super important"
.......
xyz50 = "minor and unimportant" ;
run ;
%macro myreg(j) ;
proc reg data=a ;
model y= x{&j} ;
run ;
%mend ;
data _NULL_ ;
set a ;
array x{50} abc1 def2 ...... xyz50 ;
do j = 1 to 50 ;
%myreg(j)
end ;
Will this work? I am going to try it out.
Ashok