Statalist The Stata Listserver


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

st: Re: nearmrg


From   "Michael Blasnik" <[email protected]>
To   <[email protected]>
Subject   st: Re: nearmrg
Date   Thu, 22 Jun 2006 14:30:44 -0400

"Inamo, Jocelyn F. M.D., Ph.D." <[email protected]> wrote:
> I have some trouble using the nearmrg command written by M. Blasnik. Let's say that I have two files ageinfo1 and ageinfo2, and that I want to compare income in a matched subgroup. After doing the commands below, I have a message error saying "using data not sorted"

use ageinfo2
nearmrg gender using ageinfo1, nearvar(age) genmatch(_match)


In an other set of experiment I had an other message " gender age" not unique, although I used a random process to build age, so that any combination based on age should be unique.

What step did I miss? I know this problem was pointed out, and fixed, a couple of weeks ago. But it simply does not work in my hands.
Thanks
<snip>

In answer to your first question, I believe nearmrg, like merge, requires that the -using- dataset be sorted by the variables. In your example, ageinfo1 should be sorted by gender age. Try:

use ageinfo1
sort gender age
save, replace

use ageinfo2
nearmrg gender using ageinfo1, nearvar(age) genmatch(_match)

In your other example, I'm not sure how you randomly generated ages, but if they were integers, there is no reason to think they would have to be unique. -nearmrg- checks that the values uniquely identify the observations using Stata's -isid- command.

I did find at least one strange piece of code looking at nearmrg.ado (it saves a file that isn't a temporary file, needlessly). I may fix it soon and send an update to SSC.

Michael Blasnik
[email protected]

*
* 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/




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