Nikolaos A. Patsopoulos--
No loop should be necessary, as this example demonstrates. My guess
is that this exercise is also not necessary, but as your ultimate
desired outcome is not explicit, I cannot know if replacing values is
actually a good idea for you.
input var1 var2
.145 .14
.145 .15
.145 .15
.167 .15
1.89 .15
1.89 .16
1.89 .16
end
egen oldgroup=group(var1 var2)
bys var1 var2: gen obs=_n
replace var2=var2+c(epsfloat)*obs
egen newgroup=group(var1 var2)
li, noo clean
On 2/26/07, Nikolaos A. Patsopoulos <[email protected]> wrote:
The purpose of the code is to eliminate duplicate observations of var1 &
var2 (combination).
In the firest pass the algorithm fixes duplicates but new ones might
come-up, so it should run as long as noone is left. The correction is
too small for the real data (the ones here are dummy ones just to test
the code) and the possibility of duplicates very small but still present.
var2 is changed not var1. This was a mistake I made on earlier e-mail.
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/