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 (December 2005, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 6 Dec 2005 23:41:15 -0500
Reply-To:     "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject:      Re: Eliminating rows, based on date values
Comments: To: tomas.corveleyn@GMAIL.COM

You've had other answers which will work, but here's my code (terse, tidy, tested):

data want; set have; by var_a; if dif(sasvalue)>=90 or first.var_a; run;

On Tue, 6 Dec 2005 07:29:28 -0800, Tomas <tomas.corveleyn@GMAIL.COM> wrote:

>Dear, > >I'm trying desperately to eliminate rows from the following type of >file: > >obs var_a Date Sasvalue(date) > 1 1 2/apr/02 15432 > 2 1 12/jun/03 15868 > 3 1 13/jun/03 15869 > 4 1 14/jun/03 15870 > 5 1 15/jun/03 15871 > 6 1 16/jun/03 15872 > 7 2 26/mar/02 15425 > 8 2 11/sep/03 15959 > 9 3 1/jan/03 15706 > >With var_a being the id for a person. Based on the variable "Date" or >the Sasvalue of that variable, I want to eliminate observations 3 to 6. >I do not want to end up with only one observation per person, I want to >keep the observations between which there are at least 90 days! So, my >end-file has to be the following: > >obs var_a Date Sasvalue(date) > 1 1 2/apr/02 15432 > 2 1 12/jun/03 15868 > 7 2 26/mar/02 15425 > 8 2 11/sep/03 15959 > 9 3 1/jan/03 15706 > >I've tried "retain" statements working on the Sasvalue of the >datevariable, but I haven't been able to compute the correct formula >which eliminates only observations 3 to 6. Or I eliminate to much, or I >eliminate to little. Can someone help me with this problem? > >Many thanks, > >Tomas Corveleyn.


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