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 (November 2002, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 26 Nov 2002 12:46:24 -0500
Reply-To:     Sigurd Hermansen <HERMANS1@WESTAT.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Sigurd Hermansen <HERMANS1@WESTAT.COM>
Subject:      Re: extract records
Comments: To: Max F <max8ca@YAHOO.COM>
Content-Type: text/plain; charset="iso-8859-1"

Try Proc SQL where the BETWEEN operator originates in SAS:

Create table work.subset as select * from <dataset> where date2 between (date1 - 4) and (date1 +7);

Sig

-----Original Message----- From: Max F [mailto:max8ca@YAHOO.COM] Sent: Tuesday, November 26, 2002 12:30 PM To: SAS-L@LISTSERV.UGA.EDU Subject: extract records

Hi there,

I need to extract records from two data sets. Data set One has a single date record for a given ID and Data set Two has multiple date records for a given ID. I need to pull out record from Data set Two whose date is within minus 4 days and plus 7 days of a date in Data set One.

I tried using

where date2 between (date1 - 4) and (date1 +7)

in a data step but it did not do it. It returned dates in Data set One that are more than 4 days before date2.

TIA

Max

__________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com


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