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: Merging longitudinal data set


From   Abdel Rahmen El Lahga <rahmen.lahga@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Merging longitudinal data set
Date   Fri, 16 Jul 2010 23:11:54 +0100

I think that your strategy is wrong. When you have a panel data (each
wave in a separate file) I suggest th command "append" instead of
"merge".
"append" will concatunate vertically your waves and the final data set
could be analyzed as panel. I presule that you have a variable year
identifying tha wave date. If not you should create such variable
before appending file.
Before  further analysis see the commands "xtset" "xtdes"...:)
AbdelRahmen

2010/7/16 Andreas Jensen <bentrevisor@gmail.com>:
> Hi Statalist.
>
> I'm a new Stata user (previously only used R) and I'm working on a
> project involving a longitudinal data set. There are two waves each
> contained in its own data file and there is a common ID variable which
> is consistent among the waves. I'm trying to wrap my head around the
> merge command and I'm sure this is a fairly basic question. I,
> however, would appreciate some confirmation on that what I'm doing is
> hopefully correct.
>
> What I'm troubled about is that there are people from wave 1 that has
> dropped out when wave 2 was conducted (their ID does not exist in the
> wave 2 data file), and there has been added additional people in wave
> 2 that aren't present in wave 1 (their ID does not exist in the wave 1
> data file).
>
> I have sorted each data file according to the ID variable and then
> executed a merge 1:1 on the ID with wave 1 as master. I get the
> following output.
>
>    Result                           # of obs.
>    -----------------------------------------
>    not matched                        28,046
>        from master                    12,373  (_merge==1)
>        from using                     15,673  (_merge==2)
>
>    matched                            18,742  (_merge==3)
>    -----------------------------------------
>
> So assuming that my command is correct, is it then true that there are
> 18742 individuals in both waves, 12373 individuals which has dropped
> out after wave 1 and 15673 individuals that have been added in wave 2?
>
> Thanks in advance,
> Andreas Jensen
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>



-- 
AbdelRahmen El Lahga

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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   |   Site index