Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Merging unbalanced datasets


From   Andrea Bennett <[email protected]>
To   [email protected]
Subject   Re: st: Merging unbalanced datasets
Date   Tue, 17 Jun 2008 00:00:36 +0200

Dear Leonor,

To me that looks like you should check out the Stata command -joinby- (see help joinby) which does exactly what you need. Both data sets need to be sorted according to your unique identifier (in your case - id- I guess) before you can execute the joinby command.

Kind regards,

Andrea


On Jun 16, 2008, at 11:37 PM, Leonor Saravia wrote:


Dear Statalisters,

I'm having trubles when I try to merge two datasets that have
different number of rows, because one of them has the individuals
labor history and the other only has some characteristics of them.

The first dataset ("first") looks like this:

id      job_history    inicial_year    finish_year
1          waitress         1980             1985
1          self-empl.        1986             1991
1         unemployed     1992             2000
2          journalist         1985             1990
2          unemployed      1991            2005
.
.
6          economist       1990             1999
6          self-empl.        2000             2008


And the second ("second") one like this:

id      sex       age
1        F          20
2        M         75
.
.
6       F           60

So, when I try to merge those datasets using the "first" data set as
the master data, Stata tells me that "variable id does not uniquely
identify observations in the master data", and I don�t know how to
deal with this, so I'd appreciate if you could help me.

Thank you!

Leonor

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