Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Merging longitudinal data set
From 
 
Andreas Jensen <[email protected]> 
To 
 
[email protected] 
Subject 
 
Re: st: Merging longitudinal data set 
Date 
 
Sat, 17 Jul 2010 00:40:19 +0200 
Thanks for your comments. I think I understand your point but aren't
the following two approache equivalent:
1) merging two data set with the same variables for the two waves
(different names though) and then doing a wide-to-long reshape
2) appending two data sets with the same variables and for each data
set an added generated wave variable (values 1 or 2)
For information: In the end I'll be doing a generalized linear mixed
model conditioned on different things so I'll need the data in both
wide and long format.
Best regards,
Andreas Jenen
On Sat, Jul 17, 2010 at 12:11 AM, Abdel Rahmen El Lahga
<[email protected]> wrote:
> 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 <[email protected]>:
>> 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/
>
*
*   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/