LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (October 2006, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 24 Oct 2006 18:36:24 -0400
Reply-To:   Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Subject:   Re: Imputing Dates

agree with Toby. In other words: knowing the exact rules for each case makes it easy. Simply generate the visits before and between for each patient. What was before, you get by the lag - function. Whats actual, you have. So generate all "befores" and "betweens", put them oiut with OUTPUT. How to get the first patient-record? Simply sort it and use first.patient. After you did it all, sort the result by patient and visit and you have it. With that you should have the frame. The rest is only the correct (by your rules) generation of the missing visits if there are some.

Kind of pseudo code:

proc sort visits; by patient visit; run;

data result; set visit; by patient; if first.patient then do; if we don't have the first visit, generate the preceedings; output each (in a loop?); /* incl the first one */ end; else do; /* must be a second visit */ if lag(visit)+1<visit then do; do lag(visit) to visit; calculate the "betweens" and output them; end; (maybe go only to visit-1 and output the unchanged here); end; else do; output; /* everything is ok, don't forget to output it */ end; end; (you could also OUTPUT here the "original" after generating the preceedings and betweens. Omit the outputs after the loops in that case.) run;

proc sort; by patient visit; run;

That may work or not. If not, you can use the /debug option to see where the problem is.

On Tue, 24 Oct 2006 21:43:18 +0000, toby dunn <tobydunn@HOTMAIL.COM> wrote:

>Roland you are going to have to specify what you want done with patient 2's >dates they all fall on the same day. Basically you need to post the rules >you want to follow otherwise we cant help you. >The fact that you have mulitple patients means nothing. Also do you have >data that is sequencial and dont need the imputed date added? > > >Toby Dunn > >The obscure we see eventually. The completely obvious, it seems, takes >longer. ~Edward R. Murrow > > >Think like a man of action, act like a man of thought. ~Henri Louis Bergson > > > >Alice came to a fork in the road. "Which road do I take?" she asked. >"Where do you want to go?" responded the Cheshire cat. >"I don't know," Alice answered. >"Then," said the cat, "it doesn't matter." >~Lewis Carroll, Alice in Wonderland > > > > > > >From: Roland Rivers <seatedcoin@GMAIL.COM> >Reply-To: Roland Rivers <seatedcoin@GMAIL.COM> >To: SAS-L@LISTSERV.UGA.EDU >Subject: Re: Imputing Dates >Date: Tue, 24 Oct 2006 17:28:18 -0400 > >Thanks for your solution. I think I might have over simplified things in >my example since there can been multiple patients that have this >situation. The example data would look more like this: > > >Example Input: > >Patient # Visit Visit Date >--------- ----- ------------ > 1 2 2006JUN05 > 1 4 2006AUG05 > 1 6 2006OCT05 > > 2 3 2006JAN05 > 2 5 2006JAN05 > 2 7 2006JAN05 > >etc. > >Example Output: > >Patient # Visit Visit Date >--------- ----- ------------ > 1 1 2006MAY05 <=== 31 days prior to Visit 2 date > 1 2 2006JUN05 > 1 3 2006JUL05 <=== 31 days prior to Visit 4 date > 1 4 2006AUG05 > 1 5 2006SEPT05 <=== 31 days prior to Visit 6 date > 1 6 2006OCT05 > > 2 > >etc. > >_________________________________________________________________ >Get FREE company branded e-mail accounts and business Web site from >Microsoft Office Live >http://clk.atdmt.com/MRT/go/mcrssaub0050001411mrt/direct/01/


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