Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

st: Simple but baffling - problems merging files

From   Tania Wood <>
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:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index