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: Comparing two data set
From
"Robert L. Hellpap" <[email protected]>
To
[email protected]
Subject
Re: st: Comparing two data set
Date
Wed, 02 Mar 2011 10:15:01 +0100
How about appending the data and using loops to create a difference
indication variable? If the new appended variables have the same name
as the old ones plus for example a 1 should it be possible to do it
like :
foreach x in firstoldvar-lastoldvar{
gen `x'dif=0
forvalues i=1(1)1000{
replace `x'dif=1 if `x'!=`x'1 & id==`i'
}
tab `x'1 id if `x'==1
}
Now for each individual both datasets are compared by their value, if
they are not equal the vardif-dummy should be 1 and after the replace
line the id's for which the value differs will be displayed. Not sure
if this works without problems, would be interested about comments.
(Even though I think the idea of merging is very smart und
uncomplicated)
*
* 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/