[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sas-l
Subject:    Re: question of merging by Niren
From:       Brian Lee <blee () VAX2 ! CONCORDIA ! CA>
Date:       1996-06-30 17:08:13
[Download RAW message or body]

At 12:27 PM 6/30/96 -0500, you wrote:
>____________________
>
>Hi
>
>I am a new memeber to the list and was wondering if someone could help
>me with the foll. problem:
>
>
>i have two datasets no1 and no2.
>no1 has 2 variables store and week
>no2 has three variables hhid, store and week where hhid runs from 1 to
>600.
>What i want to do is that for each value of hhid I want to merge no1 and
>no2 to get a final dataset no3 with three variables(hhid, store and
>week).
>This looks disarmingly simple but it has been pretty vexing trying to do
>this. Anyhelp will be appreciated.
>
>Thanks,
>NIren Sirohi

You can try the following merging command:

Data no1;
        input store $ week;
cards;
data
;

Proc sort data=no1;
by store week;

Data no2;
        input hhid store $ week;
cards;
data...
;
proc sort data=no2;
by store week;

data no3;
merge no1(in=x)  no2(in=y);
by store week;
if x and y; /* no3 contains hhid only when no1 and no2 have the same
variables of store                         and week */

Good luck!



Sincerely,

Brian Lee
------------------------------------------------------------
Department of Accountancy               Voice 514-848-4102
Concordia University                    FAX   514-848-8645
1455 de Maisonneuve Blvd. W. GM 600-19
Montreal, Quebec, Canada H3G 1M8
------------------------------------------------------------

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic