LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 2006, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 6 Jan 2006 08:26:59 -0500
Reply-To:     "SASsy :-)" <sas__l@HOTMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "SASsy :-)" <sas__l@HOTMAIL.COM>
Subject:      Re: SAS Program.

On Fri, 6 Jan 2006 08:01:30 -0500, Kijoeng Nam <kijoeng@GMAIL.COM> wrote:

>requirement to: compute the day interval of each >following visit from the first hospitalization. >=> I solved for one hospital x (if x = h) >if I want to get each different interval for diffrent haspital x How can I >to do? >--------------------------------------------------------------------------- --------------

Hi, nice working code. Do I understand you correctly if you want the same, just BY hospital as well?

Like this?? : [not all vars, to fit.. ] Original_ x id in out out interval

g 2 15887 15887 15887 . g 3 15887 15887 15887 . h 2 15888 15891 15891 . h 2 15949 15950 15891 58 h 3 15888 15891 15891 . h 3 15949 15950 15891 58 k 2 15892 15927 15927 . k 2 15983 15983 15927 56 k 3 15918 15927 15927 . k 3 15983 15983 15927 56

It is really simple then, just sort and set by x and id:

data t1; input enter $ 1-10 disc $ 12-21 x $ 23 id 25; datalines; 01/07/2003 01/07/2003 g 2 02/07/2003 05/07/2003 h 2 06/07/2003 10/08/2003 k 2 01/09/2003 02/09/2003 h 2 05/10/2003 05/10/2003 k 2 01/07/2003 01/07/2003 g 3 02/07/2003 05/07/2003 h 3 01/08/2003 10/08/2003 k 3 01/09/2003 02/09/2003 h 3 05/10/2003 05/10/2003 k 3 ;; run;

proc sort data=t1; by x id; run;

data t2; set t1; by x id; in = input(enter,ddmmyy10.); out = input(disc,ddmmyy10.); if first.id then do; Original_out= out ; interval = .; retain Original_out ; End ; else interval = in - Original_out; proc print; run;

Sorry if I didn't get your point.. I have that feeling :o)

S


Back to: Top of message | Previous page | Main SAS-L page