Date: Fri, 12 Dec 2003 13:43:52 -0500
Reply-To: "Droogendyk, Harry" <Harry.Droogendyk@CIBC.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Droogendyk, Harry" <Harry.Droogendyk@CIBC.COM>
Subject: Re: Help in creating the output
Content-Type: text/plain; charset="iso-8859-1"
SQL solution:
proc sql;
select id
,qtrx1 > 0 as qmd1
,sum(calculated qmd1,qtrx2) > 0 as qmd2
,sum(calculated qmd2,qtrx3) > 0 as qmd3
,sum(calculated qmd3,qtrx4) > 0 as qmd4
from your_dataset
;
quit;
-----Original Message-----
From: Prasad [mailto:prasad_prabhud@HOTMAIL.COM]
Sent: December 12, 2003 12:51 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Help in creating the output
I have the data as follows:
ID QTRX1 QTRX2 QTRX3 QTRX4
11 4 0 0 2
12 8 1 0 0
13 0 0 7 5
14 0 2 3 8
15 2 9 0 0
16 0 0 6 0
17 0 0 8 4
I want the output as follows:
ID QMD1 QMD2 QMD3 QMD4
11 1 1 1 1
12 1 1 1 1
13 0 0 1 1
14 0 1 1 1
15 1 1 1 1
16 0 0 1 1
17 0 0 1 1
So if a doctor writes a prescription in the 1st qtr, then
QMD1-QMD4
will have value of 1. WHichever quarter he starts writing,
from
there on he will have value of.
Can anybody help me in this?
Thanks
|