Statalist


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

Re: st: reorganize data


From   Robert A Yaffee <bob.yaffee@nyu.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: reorganize data
Date   Mon, 31 Dec 2007 11:02:31 -0500

You could try the following:

rename id fam
gen obsnum=_n
rename obsnum by
rename birthyrofchild byr
reshape wide by, i(fam) j(byr)

----- Original Message -----
From: DerSpiderman27@aol.com
Date: Monday, December 31, 2007 8:06 am
Subject: st: reorganize data
To: statalist@hsphsun2.harvard.edu


> Hello,
> 
> I am a STATA-beginner, but since I  need it for my diploma, I am 
> forced to 
> send you a question. 
> 
> My data is  organized as follows... for example:
> 
> ID     BirthYearOfChild
> 2         1973
> 2         1975
> 3         1954
> 4         1965
> 4         1967
> 4        1969
> 
> My problem is,  that the identifyers appear more than once. I want to 
> 
> restructure the data to  get it into the
> form:
> 
> ID     BirthYearOfFirstChild    BirthYearOfSecondChild     
> BirthYearofThirdChild
> 2      1973                             1975                           
>        
>  .
> 3      1954                             .                              
>        
>     .
> 4      1965                             1967                           
>       
> 1969
> 
> I tried with some If and ForEach and ForValues commands, but they  all 
> donīt 
> work. 
> I would be really very grateful if anyone could give me an  advice how 
> to 
> reorganize the data.
> 
> Thank you all for  reading,
> Markus.         
> 
> 
> 
> 
>    
> 
> *
> *   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–2022 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index