Statalist


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

Re: st: combining cross-sections into panel


From   Maarten buis <maartenbuis@yahoo.co.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: combining cross-sections into panel
Date   Wed, 14 May 2008 11:10:12 +0100 (BST)

You can do that in two steps, first append the datasets, then type: 
bys Uniquenum: drop if _N == 1

However, there is no need for doing that. If your panel method needs at
least two observations than it will automatically ignore the
individuals with only one observation, and if the method can handel
panels with one observation than you would throw away valuable
information. 

-- Maarten

--- Gisella Young <gisellayoung@yahoo.com> wrote:
> 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/
> 


-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


      __________________________________________________________
Sent from Yahoo! Mail.
A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index