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 (October 2010, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 19 Oct 2010 19:00:16 -0400
Reply-To:     Arthur Tabachneck <art297@NETSCAPE.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Arthur Tabachneck <art297@NETSCAPE.NET>
Subject:      Re: Hash or No-Hash solution to my problem?
Comments: To: Raghav Adimulam <raghavadimulam@WESTAT.COM>

Raghav,

I think you can get what you want with some fairly simply proc sql code. For example:

proc sql noprint; create table want as select * from have group by MRN having DateDiff <= min(DateDiff)+365 ; quit;

HTH, Art --------- On Tue, 19 Oct 2010 18:42:33 -0400, Raghav Adimulam <raghavadimulam@WESTAT.COM> wrote:

>Hello SAS-Lers, > >Here is the simplified version of my problem, i.e. without the unnecessary >fields and misc data. I have a dataset with 2 fields that is sorted on MRN >and DateDiff as shown below. > >MRN DateDiff >001 500 >001 400 >001 300 >001 200 >001 100 >001 0 > >002 500 >002 400 >002 300 >002 200 >002 100 > >003 700 >003 300 >003 200 >003 50 > >How can I accomplish a task so that I can keep only the records that fall >within 365 days of the lowest DateDiff for that MRN?? > >In other words, MRN 001 has qualifying records <=0+365 >MRN 002 has qualifying records <=100+365 (=465) >MRN 003 has qualifying records <=50+365 (=415) > >Thus the final dataset should be.. > >MRN DateDiff >001 300 >001 200 >001 100 >001 0 > >002 400 >002 300 >002 200 >002 100 > >003 300 >003 200 >003 50 > >Thanks for your answers in advance! > >-Raghav


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