[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: merging without repeat obs in master dataset

From   Svend Juul <SJ@SOCI.AU.DK>
Subject   Re: st: merging without repeat obs in master dataset
Date   Fri, 23 May 2008 08:39:15 +0200

Mingfeng wrote:

The -merge- command in Stata requires that the variable to merge
uniquely identify observations in the master dataset.  But how should
I merge if the variable I would like to merge on does not uniquely
identify master dataset observations?

For instance:
Master: ID GROUP
(multiple IDs could be in the same group)


I wanted to do
.merge GROUP using ..., sort

error message r(459):  something that should be true of your data is

My final dataset should have each ID as an observation. Is there
something I can do to work around this?


The -sort- option requires the matching key to be unique. If that
is not the case, sort the files before merging and drop the -sort-
option from the -merge- command.

Hope this helps


Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6
DK-8000  Aarhus C, Denmark
Phone:  +45 8942 6090
Home:   +45 8693 7796

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index