| Date: | Fri, 4 May 2012 16:15:25 +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: proc sql |
|
| In-Reply-To: | <201205041551.q44EhBeC013844@waikiki.cc.uga.edu> |
| Content-Type: | text/plain; charset="Windows-1252" |
Untested but the theory is there I think...
Proc Sort
Data = Have ;
By PatID ;
Run ;
Data Need ;
Do I = 1 By 1 Until( Last.PatID ) ;
Set Have ;
By PatID ;
Array MyDx1 ( 20 ) DX1-Dx20 ;
Array MyDx2 ( 20 ) ;
Do K = 1 To Dim( MyDX1 ) ;
MyDX2(K) = Max( MyDx2( K ) , MyDx1( K ) ) ;
End ;
End ;
Run ;
Toby Dunn
If you get thrown from a horse, you have to get up and get back on, unless you landed on a cactus; then you have to roll around and scream in pain.
“Any idiot can face a crisis—it’s day to day living that wears you out”
~ Anton Chekhov
> Date: Fri, 4 May 2012 11:51:50 -0400
> From: sunffang@YAHOO.COM
> Subject: proc sql
> To: SAS-L@LISTSERV.UGA.EDU
>
> Hi all,
>
> I have a bunch of dx variables, want to create a dataset at patient level,
> like:
>
> proc sql;
> create table dx1 as
> select patid,
> max(dx_drug1>0) as dx_a length=3,
> max(dx_drug2>0) as dx_b length=3,
> .
> .
> .
> .
> quit;
>
> Any easier way?
>
> Thanks for help!
>
> FS
|