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 (July 2004, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 15 Jul 2004 16:34:26 +0200
Reply-To:     "Groeneveld, Jim" <jim.groeneveld@VITATRON.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Groeneveld, Jim" <jim.groeneveld@VITATRON.COM>
Subject:      Re: How to make this fast?
Comments: To: Adriano Rodrigues - Instituto GPP <adriano@GPP.COM.BR>
Content-Type: text/plain; charset="iso-8859-1"

Hi Adriano,

In a macro loop, which you have to pack inside a macro: %MACRO Loop; %LOCAL I; %DO I = 1 %TO 40; IF p&I=0 then p&I=.; %END; %MEND;

%Loop; * Inside a data step;

Another way is not to use macro code, but an array instead, inside a data step: ARRAY P (40); or: ARRAY P (*) P1 -- P40; DO I = 1 TO 40; IF P(I)=0 THEN P(I)=.; END; DROP I;

Regards - Jim. -- . . . . . . . . . . . . . . . .

Jim Groeneveld, MSc. Biostatistician Science Team Vitatron B.V. Meander 1051 6825 MJ Arnhem Tel: +31/0 26 376 7365 Fax: +31/0 26 376 7305

My statistics are quite predictable, but my computer may be quite unpredictable.

[common disclaimer]

-----Original Message----- From: Adriano Rodrigues - Instituto GPP [mailto:adriano@GPP.COM.BR] Sent: Thursday, July 15, 2004 16:25 To: SAS-L@LISTSERV.UGA.EDU Subject: How to make this fast?

Hi all,

I have 40 variables, p1-p40.

i want to make if p1=0 then p1=.; to all 40 variables (if p2=0 then p2=., if p3=0 then p3=. etc)

can i make this in 1 loop?

thx, Adriano

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