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 (April 2000, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 24 Apr 2000 18:31:21 GMT
Reply-To:     "John M. Wildenthal" <jmwildenthal@MY-DEJA.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "John M. Wildenthal" <jmwildenthal@MY-DEJA.COM>
Organization: Deja.com - Before you buy.
Subject:      Re: Macro Question

In article <000001bfae0a$ab109580$0b01a8c0@CORE>, "J. Das" <jdas@INTEGRAINFO.COM> wrote: > Hello All, I have the following problem. Can someone please help me? > > I need to perform a Seemingly Unrelated regression (SUR) using PROC > SYSLIN; But, I need to perform this SUR for many different group of > industries. In this example, the first group consists of industries > 0400 and 0600. The next group consists of industries 1711, 1731 and > 1798. > > I need to generate the following code: > > PROC SYSLIN DATA=test SUR; > MODEL y0400=x0400; > MODEL y0600=x0600; > run; > PROC SYSLIN DATA=test SUR; > MODEL y1711=x1711; > MODEL y1731=x1731; > MODEL y1798=x1798; > run; > > The problem is I need to perform this PROC SYSLIN for many different > groups (actually 30 groups). I need to generate the texts using a > macro. However, notice that the number of model statements within the > PROC might vary. How can I generate the above code using a macro. > Can it be done? > I'm quite new in SAS/Macro. So, your help will be highly appreciated. > Thank you very much.

Primitive, but should work:

%LET model1 = 0400 0600 ; %LET model2 = 1711 1731 1798; %LET nummods = 2;

%MACRO loopthru;

%LOCAL i position token ; %DO i = 1 %TO &nummods ;

PROC SYSLIN DATA=test SUR;

%LET position = 1; %LET token = %SCAN(&&model&i,&position) %DO WHILE %LENGTH(&token) ;

MODEL y&token = x&token ;

%LET position = %EVAL(&position+1); %LET token = %SCAN(&&model&i,&position) %END;

RUN;

%END; %MEND;

%loopthru

Sent via Deja.com http://www.deja.com/ Before you buy.


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