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   Nick Cox <njcoxstata@gmail.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 18:50:53 +0100

You said

"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."

I think you need to show your code and/or explain what "could not
succeed" means. Otherwise the most predictable reply is just that your
code must have been incorrect, except that most list members would
just mutter that to themselves and not post.

If your example data were in files -nerissa2001-, -nerissa2002- this
should succeed

u nerissa2001
gen year = 2001
append using nerissa2002
replace year = 2002 if missing(year)

-- but better advice depends on better information from you.

Nick
njcoxstata@gmail.com


On 4 June 2013 18:31, Nerissa Fanoembi <nerissa_f@hotmail.com> wrote:
> 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.>>

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