Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Neil Shephard <nshephard@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: How can I merge two datasets with multiple unique identifiers? |
Date | Thu, 20 Jan 2011 15:40:23 +0000 |
On Thu, Jan 20, 2011 at 3:32 PM, Qursum Qasim <qursumqasim@gmail.com> wrote: > Hi all, > > I am trying to merge two datasets using the country and year variables > but one of the datasets also has a unique id for each observation. > When I try to merge using the command: > merge 1:1 country year using politynew > > I get the error: > variables country year do not uniquely identify observations in the using data > > What can I do to merge the two datasets without eliminating the unique > id from the using dataset? You don't need to eliminate the unique id variables (country and year) from politynew, the problem is, as -resahpe- is telling you, that these two variables do _not_ _uniquely_ identify observations in your politynew.dta file. Remove the duplicates from that file (perhaps with -duplicates drop country year, force- save the file and you should be able to merge > Thanks!! > > Best, > Qursum Qasim > > * > * 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/ > -- “Truth in science can be defined as the working hypothesis best suited to open the way to the next better one.” - Konrad Lorenz Email - nshephard@gmail.com Website - http://kimura.no-ip.org/ Photos - http://www.flickr.com/photos/slackline/ * * 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/