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 (March 2006, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 21 Mar 2006 12:47:47 -0500
Reply-To:     "Gerstle, John" <yzg9@CDC.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Gerstle, John" <yzg9@CDC.GOV>
Subject:      Re: Help on macro looping
Comments: To: Hari Nath <hari_s_nath@YAHOO.COM>
Content-Type: text/plain; charset="us-ascii"

I think I see what you're doing here... As the macro is right now (read in each dataset, sort, print, resort, print), I'd rework it like this...

%macro doit ; %let acoustixs = dlt50 dh50_100 dh100_15 ; %local i ; %do i = 1 %to 3 ; %let acoustix = %scan(&acoustixs, &i);

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 ;

John Gerstle, MS Biostatistician Northrop Grumman CDC Information Technological Support Contract (CITS) NCHSTP \DHAP \HICSB \Research, Analysis, and Evaluation Section Centers for Disease Control and Prevention

"As far as the laws of mathematics refer to reality, they are not certain; and as far as they are certain, they do not refer to reality."

Albert Einstein, addressing the Prussian Acadamy of Science, Berlin , Jan 27, 1921

"Boss. We've got cats." "Meow"

>> -----Original Message----- >> From: owner-sas-l@listserv.uga.edu [mailto:owner-sas-l@listserv.uga.edu] >> On Behalf Of Hari Nath >> Sent: Tuesday, March 21, 2006 12:29 PM >> To: SAS-L@LISTSERV.UGA.EDU >> Cc: Hari Nath >> Subject: Help on macro looping >> >> 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 ;


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