Date: Tue, 1 Jun 2004 12:54:29 -0700
Reply-To: "Schwarz, Barry A" <barry.a.schwarz@BOEING.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Schwarz, Barry A" <barry.a.schwarz@BOEING.COM>
Subject: Re: Help with the data
Content-Type: text/plain; charset="iso-8859-1"
Try something like the following
DATA new (KEEP = m1, m2, m3, m4, m5, tot_mon);
SET old;
ARRAY old_mon{5} jan feb mar apr may;
ARRAY new_mon{5} $ 1 m1 m2 m3 m4 m5;
DO i = 1 TO 5;
IF old_mon > 0 THEN
DO;
tot_mon = 6 - i;
DO j = i TO 5;
IF old_mon{j} > 0 THEN
new_mon{j-i} = 'Y'
ELSE
new_mon{j-i} = 'N';
END;
i = 5;
END;
END;
RUN;
-----Original Message-----
From: Prasad [mailto:prasad_prabhud@HOTMAIL.COM]
Sent: Tuesday, June 01, 2004 11:19 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Help with the data
I have the following sample data:
Patient Jan Feb Mar Apr May
123 2 4 6 0 3
125 0 2 3 6 0
129 1 0 2 3 3
120 0 0 1 6 2
128 0 0 0 3 9
I want the following output which shows 1 thru 5 months with flag Y or
N depending on whether Patient gets the dose starting from the
(patients) 1st month.
Patient 1 2 3 4 5 TOT_MNTHS
123 Y Y Y N Y 5
125 Y Y Y N 4
129 Y N Y Y Y 5
120 Y Y Y 3
128 Y Y 2
I would appreciate any help in this. Thanks