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 13:41:07 -0500
Reply-To:     "Nevseta, Floyd G" <Floyd.G.Nevseta@BANKOFAMERICA.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Nevseta, Floyd G" <Floyd.G.Nevseta@BANKOFAMERICA.COM>
Subject:      Re: extract records
Comments: To: Max F <max8ca@YAHOO.COM>
Content-type: text/plain; charset=iso-8859-1

A WHERE in a data step operates differently than a WHERE in SQL. If you are merging by ID in a data step the WHERE executes prior to by-group processing and before the data from the input data sets are brought into the data step. That probably accounts for your spurious results. Instead, use SQL, or substitute IF for WHERE in the data step and restructure the condition to remove the BETWEEN which is only valid in SQL.

Regards, Floyd

-----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