Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: Combine sectional data files of different years into one panel data file


From   Nerissa Fanoembi <nerissa_f@hotmail.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Combine sectional data files of different years into one panel data file
Date   Tue, 4 Jun 2013 19:31:48 +0200

Thanks for your reply. But this is already done.

----------------------------------------> Date: Tue, 4 Jun 2013 18:28:04 +0100> Subject: Re: st: Combine sectional data files of different years into one panel data file> From: njcoxstata@gmail.com> To: statalist@hsphsun2.harvard.edu>> This is a problem for -append-, not -merge-. But you will need to> ensure that the year is a variable within each data file first.>> Nick> njcoxstata@gmail.com>> On 4 June 2013 18:22, Nerissa Fanoembi <nerissa_f@hotmail.com> wrote:>>> I am trying to combine cross sectional data files of different years into one panel data file. In the cross sectional files two variables uniquely identify each person. Household number and the number of the member in the household. Below I make a simple example where I have cross sections for years 2001 and 2002. Each dataset includes variables such as the identification number of the household (nohhold) and the member of the household (nomem) and some other background characteristics (for instance age and varon!
 e). I would like to have all the observations for each variable and ordered over time for each individual. I tried the merge (1:1 using nohold and nomem together to uniquely identify each individual), append, or a combination of those commands, but could not succeed.>> Could anyone please tell me the correct command I should be using.>>> Example:>> 2001:>> nohhold nomem age varone>> 1. 6 1 64 yes>> 2. 6 2 55 yes>> 3. 21 1 54 .>> 4. 21 2 40 .>> 5. 21 3 25 no>> 2002:>> nohhold nomem age varone>> 1. 6 1 64 yes>> 2. 6 2 55 yes>> 3. 6 3 15 no>> 4. 21 1 54 yes>> 5. 21 2 40 yes>> Desired panel structure should be like this:>> nohhold nomem age varone year>> 1. 6 1 64 yes 2001>> 2. 6 1 64 yes 2002>> 3. 6 2 55 yes 2001>> 4. 6 2 55 yes 2002>> 5. 6 3 15 no 2002>> 6. 21 1 54 . 2001>> 7. 21 1 54 yes 2002>> 8. 21 2 40 . 2001>> 9. 21 2 40 yes 2002>> 10.21 3 25 no 2001>> *> * For searches and help try:> * http://www.stata.com/help.cgi?search> * http://www.stata.com/support/faqs/resources/s!
 tatalist-faq/> * http://www.ats.ucla.edu/stat/stata/ 		 	   		  
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index