Date: Tue, 4 Sep 2007 13:59:18 +0000
Reply-To: toby dunn <tobydunn@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: toby dunn <tobydunn@HOTMAIL.COM>
Subject: Re: arrays and DO
In-Reply-To: <200709041330.l84AkSce022702@malibu.cc.uga.edu>
Content-Type: text/plain; format=flowed
This is almost what I originally sent him in the begginig of this thread.
Since you brought up efficiency I originally added and still would add a
leave statement:
selec=0;
do i=1 to 35;
if icd10a{i}=:'I2' then do ;
selec=1;
Leave ;
end;
End ;
Toby Dunn
Comprimise is like telling a lie, it gets easier and easier. Each
comprimise you make, that becomes your standard.
Perfection doesnt exist, once you reach it, its not perfect anymore. It
means something else.
From: Douglas Martin <douglas.martin@GLOBALIQ.COM>
Reply-To: Douglas Martin <douglas.martin@GLOBALIQ.COM>
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: arrays and DO
Date: Tue, 4 Sep 2007 09:30:57 -0400
On Mon, 3 Sep 2007 04:46:41 +0000, Laughing Beggar
<laughing_beggar@HOTMAIL.COM> wrote:
>...
>90 data ohospx001b;
>91 set ohospx001a;
>92 array icd10a{35} icd10d1-icd10d35;
>93 do i=1 to 35;
>94 if icd10a{i}=:'I2' then selec=1;else selec=0;
>95 end;
>96 run;
>...
That code doesn't do what you intended. In fact it very inefficiently
checks whether icd10a{35} starts with I2 - if anything earlier starts with
I2 that will be forgotten in subsequent iterations of the loop.
You want something like
selec=0;
do i=1 to 35;
if icd10a{i}=:'I2' then selec=1;
end;
_________________________________________________________________
A place for moms to take a break!
http://www.reallivemoms.com?ocid=TXT_TAGHM&loc=us