Date: Wed, 22 Aug 2007 16:03:01 -0400
Reply-To: Muthia Kachirayan <muthia.kachirayan@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Muthia Kachirayan <muthia.kachirayan@GMAIL.COM>
Subject: Re: array question
In-Reply-To: <200708221915.l7MFRk9O015787@mailgw.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1
Annie,
Here is the way.
data given;
input doc1 doc2 doc3 doc4 pdate1 pdate2 pdate3 pdate4 proc1 proc2 proc3
proc4;
cards;
1 2 . . 070531 070602 . . 101 102 . .
3 4 5 6 060304 030309 060305 060307 201 202 203 204
1 7 8 . 060911 060912 060910 . 301 302 303 .
;
run;
data wanted(keep=doc date proced);
retain doc date proced;
array d[4] doc1-doc4;
array pd[4] pdate1-pdate4;
array pr[4] proc1-proc4;
set given;
do i = 1 to 4;
if d[i] = . then continue;
doc = d[i];
date = pd[i];
proced = pr[i];
output;
end;
run;
proc sort data = wanted;
by doc;
run;
proc print data = wanted;
run;
Hope this answers you.
Muthia Kachirayan
On 8/22/07, Annie Lee <hummingbird10111@hotmail.com> wrote:
>
> Hi,
>
> I have a dataset with doctor id, proceduredate, procedure number.
> What is the best way to have the following results?
> Thank you.
>
>
> Data:
>
> doc1 doc2 doc3 doc4 pdate1 pdate2 pdate3 pdate4 proc1 proc2 proc3 proc4
>
> 1 2 070531 070602 101 102
> 3 4 5 6 060304 030309 060305 060307 201 202 203 204
> 1 7 8 060911 060912 060910 301 302 303
>
>
> Results:
>
> doc date proced
>
> 1 070531 101
> 1 060911 301
> 2 070602 102
> 3 060304 201
> 4 030309 202
> 5 060305 203
> 6 060307 204
> 7 060912 302
> 8 060910 303
>
|