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 (August 2006, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 16 Aug 2006 15:57:36 -0400
Reply-To:     Joe Whitehurst <joewhitehurst@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Joe Whitehurst <joewhitehurst@GMAIL.COM>
Subject:      Re: Macro loop
Comments: To: "data _null_," <datanull@gmail.com>
In-Reply-To:  <7367b4e20608160726r3eb554d8g1021392775348ac8@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Excellent idea. Bad Macro Name. Why not use proc append and call the macro appenddata?

On 8/16/06, data _null_; <datanull@gmail.com> wrote: > From your example you have data that differs only by one variable > "TEST" with 50 levels. Unless you have some other compelling reason > don't call GLM 50 times. Put your 50 data sets together, same the one > data set, and call GLM and other procedures with a BY statement. You > will be much happier in the long run. > > Consider... > > %macro joinData; > %local i; > data work.test; > set > %do i = 1 %to 50; > work.test&i(in=in&i) > %end; > ; > test = > %do i = 1 %to 50; > in&i*&i + > %end; > 0; > run; > %mend joinData; > %joinData; > proc glm data=work.test; > by test; > class hnr; > model drs = d1 hnr / solution; > run; > > > On 8/16/06, Sebastian Hein <Sebastian.Hein@forst.bwl.de> wrote: > > Hello! > > > > I want to run the following GLM 50 times using a macro loop; > > At each run the dataset changes, starting from test1 to test50; > > However my code does not work as I want: > > > > %macro doGLM; > > PROC GLM data=test&m ; > > class HNR ; > > model DRS = d1 HNR / s ; > > RUN; > > %mend; > > > > %macro loop1to50; > > do i= 1 to 50; > > %let m=i %doGLM; > > end; > > %mend; > > > > %loop1to2; > > > > Any help would be appreciated. > > Sebastian > > > > > > 1848 %loop1; > > NOTE: Line generated by the invoked macro "LOOP1". > > 1 do i= 1 to 2; > > -- > > 180 > > ERROR 180-322: Statement is not valid or it is used out of proper order. > > > > NOTE: Line generated by the invoked macro "LOOP1". > > 3 end; > > --- > > 180 > > ERROR 180-322: Statement is not valid or it is used out of proper order. > > >


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