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 2007, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 28 Aug 2007 18:31:25 -0400
Reply-To:     Sigurd Hermansen <HERMANS1@WESTAT.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Sigurd Hermansen <HERMANS1@WESTAT.COM>
Subject:      Re: Problems with SAS code
Comments: To: ivan5ive@hotmail.com
In-Reply-To:  <1188334813.138408.33850@19g2000hsx.googlegroups.com>
Content-Type: text/plain; charset="us-ascii"

The '&IND' SAS Macrovariable would have to be defined outside the segment of SAS Macro MODEL that appears in your post. The RETAIN statement really works as described in SAS documentation, strange as that might seem.

A SAS Macro falls somewhere in between a script and a stored procedure. If you have instructions on how to execute it, then follow those. If you are trying to figure out how to use a SAS Macro of dubious origins, I don't think that we can give you the level of help that you need. Judging from the simplicity and repetition of the segment of the SAS Macro that you have posted, you may be better off starting from scratch. I don't see anything in it that couldn't be done better with standard SAS procedures.

Sorry to have to be the bearer of bad news. S

-----Original Message----- From: owner-sas-l@listserv.uga.edu [mailto:owner-sas-l@listserv.uga.edu] On Behalf Of ivan5ive@hotmail.com Sent: Tuesday, August 28, 2007 5:00 PM To: sas-l@uga.edu Subject: Problems with SAS code

Hi everybody, I have this SAS code: [code] %MACRO MODEL; DATA NEW1; ARRAY PIP(&IND); SET TAB12(OBS=&IND) END=FINE; IF _N_=1 THEN I=1; ELSE I+1; PIP(I)=PERCENT; IF FINE THEN OUTPUT; RETAIN PIP1-PIP&IND; /************************************/ DATA NEW2; ARRAY VX(&IND1) $ 20.; SET TAB1(OBS=&IND1) END=FINE; IF _N_=1 THEN I=1; ELSE I+1; VX(I)=VARX; IF FINE THEN OUTPUT; RETAIN VX1-VX&IND1; /********************/ DATA NEW3; ARRAY VY(&IND2) $ 20.; SET TAB2(OBS=&IND2) END=FINE; IF _N_=1 THEN I=1; ELSE I+1; VY(I)=VARY; IF FINE THEN OUTPUT; RETAIN VY1-VY&IND2; /********************/ DATA VECT; SET NEW1; ARRAY PIP{&IND}; ARRAY PIJ{&IND1,&IND2}; K=1; DO I=1 TO &IND1; DO J=1 TO &IND2; PIJ{I,J}=PIP(K)/100; K=K+1; END; END; RETAIN PIJ1-PIJ&IND; /******************/ DATA RESULTS MODEL3A MODEL3B zzzz; SET NEW1; SET NEW3; SET NEW2; SET VECT; ARRAY VX{&IND1} $20. VX1-VX&IND1 ; ARRAY VY{&IND2} $20. VY1-VY&IND2; ARRAY SR{&IND1} $20.; ARRAY SC{&IND2} $20.; ARRAY PIJ{&IND1,&IND2} $20. PIJ1-PIJ&IND; FORMAT CATEGVAX $ 20. CATEGVAY $ 20. MODEL $ 40.; [/code]

First of all I don't understand what it want to do cause: I don't Know &IND at the third line; I don't understand the RETAIN statement from the manual. Please for the suggestions and thanks for the help.

Donato


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