Statalist


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

Re: st: combining cross-sections into panel


From   "Eva Poen" <[email protected]>
To   [email protected]
Subject   Re: st: combining cross-sections into panel
Date   Wed, 14 May 2008 11:00:23 +0100

Gisella,

I don't see why -append- should not work in your case. It's important
that the period variable is present in the original data sets;
otherwise it would be difficult to trace which observation came from
where.

Try the following:
-append- all datasets to form a big dataset. Then check for
-duplicates- in terms of Uniquenum and keep only those households with
at least two observations. Finally, you can -tsset Uniquenum period-,
and you are done.

Eva

2008/5/14 Gisella Young <[email protected]>:
> I have several cross-sections of household data at different times, which have the same variables and have some common participants between them, who are identified with a unique number. The format of each dataset is as follows:
>
>  Uniquenum    var1   var2    var3    period
>  1              32 ...                 1
>  2               ..........            1
>  4 .......
>
>
>  And then for the second dataset
>  Uniquenum    var1   var2    var3    period
>  2              67 ...                 2
>  3               ..........            2
>  4  .......
>
>  and so on. I need to combine these cross-sections into a panel in which the people who appear in more then more cross-section (identified by their unique numbers appearing in more than one cross-section) are retained and their values of the variables are kept in a panel format (ie with the value of var1 for period 1, period 2 etc), i.e. perhaps as follows or something similar:
>
>  Uniquenum    var1   var2    var3    period
>  2             32 ...                 1
>  2             67  ..........         2
>  4             .......                1
>  4                 .....              2
>
>
>  I have tried -merge-, -append-, and -joinby- with various specifications but am not getting the desired result. For example, I get outcomes in which for the common people, the variable values from the master dataset are retained and the only addition from the second dataset are the 'new' people, or where the outcome is not a panel. I have tried formatting each dataset as a panel before combining them, and specifying period as the time variable and uniquenum as the cross-sectional identifier, but still no luck. I have read the relevant FAQ and also searched the archive but am not getting the correct approach - perhaps what I am asking is too simple to have been asked before. Any suggestions would be much appreciated.
>
>  best,
>  Gisella
>
>
>
>
>
>
>  *
>  *   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