Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Merge two data sets


From   "Vimalanand S. Prabhu" <[email protected]>
To   <[email protected]>
Subject   Re: st: Merge two data sets
Date   Fri, 18 Apr 2003 16:55:49 -0400

Dear David,

Thank you, initially I was having problems because of not renaming the
variables. The final command I used was:
joinby hhid using thai_hh2, unmatched(both)

Thanks,



Prabhu





----- Original Message -----
From: "David Kantor" <[email protected]>
To: <[email protected]>
Sent: Friday, April 18, 2003 4:16 PM
Subject: Re: st: Merge two data sets


> At 03:30 PM 4/18/2003 -0400, Vimalanand wrote:
> >Dear Friends
> >
> >I have following two datasets
> >
> >Dataset 1 with 2 rows
> >Data set 2 with 5 rows
> >I want the resultant dataset to be 2x5 = 10 rows for the household
> >
> >
> >Data set 1.
> >
> >OBVS1ID HHID  PersonID  PersonCharacteristcis
> >25                   1            1
> >26                   1            2                .....Matrix(X1)
> >
> >Data set 2 (from Census)
> >OBVS2ID HHID    PersonID    Person&other_characteristics
> >A21            1            1
> >A22            1            2
> >A23            1            3                      .....Matrix(X2)
> >A24            1            4
> >A25            1            5
> >
> >Resultant data set
> >
> >OBVS1ID    OBVS2ID     HHID   PersonID1    PersonID2  Person_charac
> >Person& other charac
> >25                    A21            1            1                    1
> >25                    A22            1            1                    2
> >25                    A23            1            1                    3
> >25                    A24            1            1                    4
> >25                    A25            1            1                    5
> >26                    A21            1            2                    1
> >26                    A22            1            2                    2
> >26                    A23            1            2                    3
> >26                    A24            1            2                    4
> >26                    A25            1            2                    5
>
> I think what you want is -joinby-
>
> But you may need to rename some variables (PersonID and other person
> characteristics) to make them distinct -- where they exist in both
> datasets, and originally have the same name, but are not part of the
joinby
> key.
>
>
> David Kantor
> Institute for Policy Studies
> Johns Hopkins University
> [email protected]
> 410-516-5404
>
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index