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 at the end of May, and its replacement, statalist.org is already up and running.


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

st: Simple but baffling - problems merging files


From   Tania Wood <Tania.Wood@ed.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   st: Simple but baffling - problems merging files
Date   Mon, 13 Dec 2010 11:19:43 +0000

Dear statalisters,

My query should be straightforward, but it's baffling me.

I'm trying to merge two STATA datasets by matching on the respondent's
individual pid: the datasets are wave 1 and wave 2 of a longitudinal study. My problem is that I can't get all the case pids in wave 2 to match their wave 1 pid.

In the wave 2 dataset, I've retained only cases where the respondent
is the same as in the previous wave (n = 4,435). So I would expect the
matched dataset to contain 4,435 cases and variables from wave 1 and
wave 2.

However, when I merge the two datasets using the following command:

merge 1:1 idnumber using "filename.dta"

Stata tells me that a number of cases have not been matched (14).  When I
try the same operation in SPSS, the match works and the new
wave1/wave2 dataset has 4,435 cases.

The dataset was originally created in SPSS, and deposited in the UK data archive in SPSS and Stata format. There are too many variables in the deposited dataset for me to be able to open it with my version of Stata, so I have been creating mini datasets with my variables of interest and saving them in Stata format for analysis. Could something have gone wrong during the save?

I'd be really grateful for any pointers on this!

Tania Wood

University of Edinburgh


--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.



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