Date: Thu, 19 May 2011 07:44:36 -0400
Reply-To: Dave <david.brewer@UC.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Dave <david.brewer@UC.EDU>
Subject: Drug Switching
Hi SAS-Lers
I need to find out which patient switched drugs and also if they switched
determine the first time they switched.
data in;
input pid drug date:mmddyy10.;
format date mmddyy10.;
cards;
1 1234 1/1/2010
1 1234 2/1/2010
1 1234 3/1/2010
2 34 3/5/2010
2 34 4/1/2010
2 45 5/2/2010
2 56 6/3/2010
3 55 4/1/2010
3 56 5/1/2010
3 57 6/1/2010
3 57 7/1/2010
4 123 6/3/2010
5 55 7/1/2010
5 55 7/24/2010
;
run;
Since pid 1, 4, and 5 never switched they would be outputted to NO_SWITCH
data set.
PID 2 had an initial switch from date 3/5/2010 and 5/2/2010; i.e., changed
drugs from 34 to 45. I need to output those two records to data set
SWITCHED.
PID 3 would output drug 55 and 56 to data set SWITCHED.
Any suggestions?
Thanks for your help.
Dave