| Date: | Wed, 16 Jan 2002 16:47:42 -0500 |
| Reply-To: | Roger Lustig <rlustig@CBDCREDIT.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Roger Lustig <rlustig@CBDCREDIT.COM> |
| Organization: | Creative Business Decisions, Inc. |
| Subject: | Re: Newbie:Merging problem |
| Content-Type: | text/plain; charset=us-ascii; format=flowed |
Two solutions:
--in a data step, take the earlier file and rename the earlier date/time
and create a new variable with the original name, but with one second
added. Merge this new file to the later file.
--SQL:
proc sql;
create table merged as
select a.*,b.* from
earlier(rename=(datetime=earlytime)) a
,
later(rename=(datetime=latertime)) b
where a.earlytime+1=b.latertime
;
quit;
(This will produce a file with only the cases that match. If you want
the non-matching ones in there, you'll have to do some other join.)
Roger
Kim Nhac Le wrote:
> Hello,
> I'm sorry about this silly question but I have been looking the text
> books to figure out how to merge these datasets and i'm still stuck.
> suppose I have two data sets that have a date/time in each
> observations. The problem is that I want to merge the two data sets by
> the date/time. BUT, the date/time aren't really the same in the two
> data sets. One would be 1 second ahead of the other.
>
> Thanks.
>
>
>
|