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 (February 2001, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 1 Feb 2001 19:49:53 GMT
Reply-To:     care781@MY-DEJA.COM
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         care781@MY-DEJA.COM
Organization: Deja.com
Subject:      selecting most recent dates

Hallo,

I need to find a way of choosing the two dates just before and just after a third date (date of retirement).

Each individual has multiple interviews, each in its own row. A variable 'DATE' identifies the date of interview. Different individuals have different numbers of interviews. There is also a variable called 'RETDATE' that identifies each individual's date of retirement.

What I want to do is select the two interviews just before and the two interviews just after RETDATE, and create a file with only those 4 interviews for each individual, each in its own row.

Some people may not have 2 interview dates before and after retirement, but I want 4 cases/rows for each person all the same.

I wrote some really clunky code which works (sorting the positive and negative differences in days separately, and using the 'first.id' variable, blah blah), but I know there is a much more elegant approach, probably using arrays or loops or something wonderfully simple but beyond my grasp at the moment.

Any help would be much appreciated,

C.

Sent via Deja.com http://www.deja.com/


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