| Date: | Tue, 21 Mar 2006 17:51:24 +0000 |
| Reply-To: | toby dunn <tobydunn@HOTMAIL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | toby dunn <tobydunn@HOTMAIL.COM> |
| Subject: | Re: Help on macro looping |
|
| In-Reply-To: | <200603211729.k2LFpBw7024649@mailgw.cc.uga.edu> |
| Content-Type: | text/plain; format=flowed |
|---|
Hari ,
You need to make acoustix a global macro var, however you wont be able to
use the same variable as you parameters are strictly local to that macro.
One simple method is:
%macro test1( var1 = ) ;
%global var1B ;
%let Var1B = &Var1 ;
%mend ;
%test1( var1 = Testing Passing Global Parameter )
%put Var1 = &Var1B ;
Another is:
%let Var1 = Testing Passing Global Parameter ;
%macro test1( var1 = ) ;
%Put Var1 = &Var1 ;
%mend ;
%test1( var1 = &Var1 )
%put Var1 = &Var1 ;
Toby Dunn
From: Hari Nath <hari_s_nath@YAHOO.COM>
Reply-To: Hari Nath <hari_s_nath@YAHOO.COM>
To: SAS-L@LISTSERV.UGA.EDU
Subject: Help on macro looping
Date: Tue, 21 Mar 2006 12:29:17 -0500
Hi all,
The first part of the following code works ok, but anybody can correct
me with the second part, it would be very helpful. Iam not sure if i need
to create acoustix as a global variable or do it other way...thanks so
much......hari
*first part ;
%macro modelling(acoustix) ;
proc mixed data=subset method=reml;
class product week subject;
model &acoustix = product / ddfm=satterth;
random subject week(subject) / type=vc;
lsmeans product / pdiff;
by conc measure;
ods output lsmeans=out Tests3=tests3 diffs=diff&acoustix covparms=cp;
title "study data for '&acoustix' -- diff";
run;
%mend modelling ;
%modelling(dlt50)
%modelling(dh50_100)
%modelling(dh100_15)
run ;
*second part ;
%let average1 = dlt50 ;
%let average2 = dh50_100 ;
%let average3 = dh100_15 ;
%macro doit ;
%local i ;
%do i = 1 %to 3 ;
data stn&acoustix; set diff&acoustix ; if conc=150; abs_t=abs
(tvalue); run;
proc sort data=stn&acoustix out=v9._&acoustix_stn_t; by measure
descending abs_t; run;
proc print data=v9._&acoustix_stn_t;
title "study data for '&acoustix' -- diff";
title2 " 'AVERAGE&i' sort order MEASURE desc ";
run;
proc sort data=stn&acoustix out=v9._&acoustix_stn_p; by measure
probt; run;
proc print data=v9._&acoustix_stn_p;
title "study data for '&acoustix' -- diff";
title2 " 'AVERAGE&i' sort order MEASURE ";
run;
%end ;
%mend doit ;
|