|Date: ||Thu, 25 Mar 2004 23:07:10 -0500|
|Reply-To: ||Howard Schreier <Howard_Schreier@ITA.DOC.GOV>|
|Sender: ||"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>|
|From: ||Howard Schreier <Howard_Schreier@ITA.DOC.GOV>|
|Subject: ||Re: merge question|
I think this will be done more easily with SQL. It will probably help to
preprocess the "actual" dataset and assign unique key values.
On Thu, 25 Mar 2004 12:03:50 -0800, Philip Primak
>Here is my problem: I have two data set the first is actual data, for
>example two variables A and B
>and the second one is "model", for example two variables A and SCORE
>I have to find for each non missing value A in the first data set
>value the "model" data, and take score from there. If there is no
>match (the value A in the first data set does not have exact match in
>one) I have to take the closest possible, so for A=1.2 in the first
>"match" will be A=1 in the model data, for A=1.7 in the first such
>be A=2 in the second, etc. In case if my value in the original data
>between two model values -like A=8 has two closest matches: A=6 and
>A=10 in the
>model data, I should take the average value of SCORE. So after
>merge I should get data set:
>A B SCORE
>. 0 .
>1.2 1 10
>1.7 2 20
>. 3 .
>8 4 65
>. 5 .
>. 6 .
>Any help is greatly appreciated.