Thanks Ballardw for the link, the process wasn't too hard to follow.
The requested data step;
data SHRREL.TestVisit;
infile datalines dsd truncover;
input PTID:$11. VISITID:BEST12. VISIT_TYPE:$19. VISIT_START_DATE:MMDDYY10. VISIT_END_DATE:MMDDYY10. DISCHARGE_DISPOSITION:$34. vstdt:DATE9. vendt:DATE9. newdt:32.;
datalines4;
PT000000022,673482272,Emergency patient,10/04/2008,10/04/2008,Not recorded,04OCT2008,04OCT2008,
PT000000022,673482273,Emergency patient,11/10/2008,11/10/2008,01 Discharged to home or self care,10NOV2008,04OCT2008,
PT000000022,673482274,Emergency patient,07/30/2011,07/30/2011,Not recorded,30JUL2011,10NOV2008,
PT000000022,673482271,Inpatient,06/21/2010,06/22/2010,01 Discharged to home or self care,21JUN2010,22JUN2010,
PT000000099,610952548,Emergency patient,08/24/2010,08/24/2010,01 Discharged to home or self care,24AUG2010,24AUG2010,
PT000000099,610952549,Emergency patient,08/14/2012,08/14/2012,01 Discharged to home or self care,14AUG2012,24AUG2010,
PT000000099,610952547,Inpatient,03/21/2010,03/23/2010,01 Discharged to home or self care,21MAR2010,23MAR2010,
PT000000132,610888961,Observation patient,11/27/2009,11/27/2009,Not recorded,27NOV2009,27NOV2009,
PT000000159,655709236,Emergency patient,01/22/2007,01/22/2007,01 Discharged to home or self care,22JAN2007,22JAN2007,
PT000000159,655709237,Emergency patient,03/30/2007,03/31/2007,Not recorded,30MAR2007,22JAN2007,
PT000000159,655709238,Emergency patient,04/29/2007,04/30/2007,01 Discharged to home or self care,29APR2007,31MAR2007,
PT000000159,655709239,Emergency patient,05/06/2007,05/06/2007,01 Discharged to home or self care,06MAY2007,30APR2007,
PT000000159,655709240,Observation patient,08/31/2007,08/31/2007,Not recorded,31AUG2007,06MAY2007,
PT000000159,655709241,Emergency patient,09/17/2007,09/17/2007,01 Discharged to home or self care,17SEP2007,31AUG2007,
PT000000159,655709242,Emergency patient,04/30/2008,04/30/2008,01 Discharged to home or self care,30APR2008,17SEP2007,
PT000000159,655709243,Emergency patient,08/06/2008,08/06/2008,01 Discharged to home or self care,06AUG2008,30APR2008,
PT000000159,655709244,Inpatient,09/17/2008,09/17/2008,01 Discharged to home or self care,17SEP2008,06AUG2008,
PT000000159,655709245,Emergency patient,11/30/2008,11/30/2008,01 Discharged to home or self care,30NOV2008,17SEP2008,
PT000000159,655709246,Emergency patient,12/12/2008,12/12/2008,01 Discharged to home or self care,12DEC2008,30NOV2008,
PT000000159,655709247,Emergency patient,01/03/2009,01/03/2009,01 Discharged to home or self care,03JAN2009,12DEC2008,
PT000000159,655709248,Emergency patient,01/09/2009,01/09/2009,Not recorded,09JAN2009,03JAN2009,
PT000000159,655709249,Emergency patient,02/28/2009,02/28/2009,01 Discharged to home or self care,28FEB2009,09JAN2009,
PT000000159,655709250,Emergency patient,05/09/2009,05/10/2009,01 Discharged to home or self care,09MAY2009,28FEB2009,
PT000000159,655709251,Emergency patient,05/19/2009,05/19/2009,01 Discharged to home or self care,19MAY2009,10MAY2009,
PT000000159,655709252,Emergency patient,09/09/2009,09/10/2009,Not recorded,09SEP2009,19MAY2009,
PT000000159,655709253,Emergency patient,11/20/2009,11/20/2009,01 Discharged to home or self care,20NOV2009,10SEP2009,
PT000000159,655709254,Emergency patient,02/16/2010,02/16/2010,01 Discharged to home or self care,16FEB2010,20NOV2009,
PT000000159,655709255,Emergency patient,04/11/2010,04/11/2010,Not recorded,11APR2010,16FEB2010,
PT000000159,655709256,Emergency patient,06/12/2010,06/12/2010,07 Left against medical advice,12JUN2010,11APR2010,
PT000000159,655709257,Emergency patient,06/29/2010,06/29/2010,Not recorded,29JUN2010,12JUN2010,
PT000000159,655709258,Emergency patient,07/13/2010,07/13/2010,01 Discharged to home or self care,13JUL2010,29JUN2010,
PT000000159,655709259,Emergency patient,08/07/2010,08/07/2010,01 Discharged to home or self care,07AUG2010,13JUL2010,
PT000000159,655709260,Emergency patient,08/23/2010,08/23/2010,Not recorded,23AUG2010,07AUG2010,
PT000000159,655709261,Emergency patient,11/22/2010,11/23/2010,01 Discharged to home or self care,22NOV2010,23AUG2010,
PT000000159,655709262,Emergency patient,01/25/2011,01/26/2011,01 Discharged to home or self care,25JAN2011,23NOV2010,
PT000000159,655709263,Emergency patient,05/01/2011,05/01/2011,Not recorded,01MAY2011,26JAN2011,
PT000000159,655709264,Emergency patient,08/19/2011,08/19/2011,01 Discharged to home or self care,19AUG2011,01MAY2011,
PT000000159,655709265,Emergency patient,05/07/2012,05/07/2012,01 Discharged to home or self care,07MAY2012,19AUG2011,
PT000000159,655709266,Emergency patient,11/05/2012,11/06/2012,01 Discharged to home or self care,05NOV2012,07MAY2012,
PT000000159,655709223,Inpatient,06/03/2007,06/07/2007,01 Discharged to home or self care,03JUN2007,07JUN2007,
PT000000159,655709224,Inpatient,01/20/2008,01/21/2008,01 Discharged to home or self care,20JAN2008,07JUN2007,
PT000000159,655709225,Inpatient,10/24/2010,10/26/2010,01 Discharged to home or self care,24OCT2010,21JAN2008,
PT000000159,655709226,Observation patient,12/14/2009,12/14/2009,01 Discharged to home or self care,14DEC2009,14DEC2009,
PT000000225,611184911,Inpatient,06/29/2012,07/01/2012,06 Discharged/transferred to home,29JUN2012,01JUL2012,
PT000000225,611184912,Inpatient,10/05/2012,10/09/2012,01 Discharged to home or self care,05OCT2012,01JUL2012,
PT000000334,682072164,Emergency patient,06/08/2009,06/08/2009,Not recorded,08JUN2009,08JUN2009,
PT000000334,682072163,Inpatient,06/09/2009,06/10/2009,06 Discharged/transferred to home,09JUN2009,10JUN2009,
PT000000337,697620729,Emergency patient,12/03/2010,12/03/2010,01 Discharged to home or self care,03DEC2010,03DEC2010,
PT000000337,697620730,Emergency patient,12/10/2010,12/10/2010,01 Discharged to home or self care,10DEC2010,03DEC2010,
PT000000378,682406411,Emergency patient,01/24/2008,01/24/2008,Not recorded,24JAN2008,24JAN2008,
;;;;
charlesj
... View more