Statalist The Stata Listserver


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

RE: st: Re: Using NEARMRG


From   "MA V" <[email protected]>
To   [email protected]
Subject   RE: st: Re: Using NEARMRG
Date   Wed, 26 Apr 2006 22:44:04 +0000

I know you're the author and I thank you for these and many other programs that have helped me a lot.
One of the things I tried was dropping all the duplicates for both region and age in the using file (before doing the merge):
duplicates drop age, force
duplicates drop region, force

This should have made the nearvar unique in the using dataset within levels of the varlist, right?

But I keep getting the same error message.

Another thing that I forgot to mention is that, in my case age is a string variable (and yes, I used the option "upper" to prevent getting error messages related with the fact that the nearvar is a string variable).

If you have any suggestions I would appreciate your help.
Thanks!



From: "Michael Blasnik" <[email protected]>
Reply-To: [email protected]
To: <[email protected]>
Subject: st: Re: Using NEARMRG
Date: Wed, 26 Apr 2006 18:14:31 -0400

I'm the author of nearmrg. The help message is quite clear here and, although you may have tried "many things" it doesn't seem like those things included addressing the error message. The nearvar must be unique in the using dataset within levels of the varlist (region in your case). In your case, the combination of region and age do not uniquely identify the using dataset observations and so the nearest match can not be determined since there may be more than one. -nearmrg- serves as a lookup function and you have a lookup table with non-unique (and therefore ambiguous) values.

The sort order of your data does not matter since nearmrg appends the datasets together and does its own sorting.

Michael Blasnik
[email protected]


----- Original Message ----- From: "MA V" <[email protected]>
To: <[email protected]>
Sent: Wednesday, April 26, 2006 5:59 PM
Subject: st: Using NEARMRG



I just came across a very interesting function named "nearmrg" and I have a question regarding its use:
If I write:

neamrg region using ageinfo2, nearvar(age) keep

In this case, I have the following questions:
1) "age" must be unique in the using dataset, right?
2) does the variable region need to be unique?
3) how should I sort the variables?

I tried many different things and I always seem to get the message:

"region age not unique in using dataset
something that should be true of your data is not"

Any suggestions?
Thanks for your help!!
*
*   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/
_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar � get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/

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