Statalist


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

Re: st: How to identify observations in Using file for further analysis with "nearmrg" command


From   hmjc66 <hmjc66@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: How to identify observations in Using file for further analysis with "nearmrg" command
Date   Mon, 2 Jul 2007 16:52:28 -0400

Thanks for your suggestion, Rajesh.

I have a more serious issue though. I noticed that -nearmrg- can pick
the closest observation from the Using file multiple times. I require
that it be picked only once.

Is there any way that an observation from the using file will be
picked only once using -nearmrg-? (i.e. after picking an observation,
go to the next closest observation)

Hugh



On 7/2/07, Rajesh Tharyan <R.Tharyan@exeter.ac.uk> wrote:
Hi,

Try it with option "keep"

If you type help nearmrg you see the syntax definition and description of
the various options

nearmrg [varlist] using , nearvar(varname) [genmatch(newvarname) lower upper
roundup keep mergeoptions]

see..


mergeoptions :  allows the user to specify any of the standard options for
merge such as update, _merge(varname),etc.  One difference from the standard
behavior of merge is that nokeep is the default but can be overridden by the
keep option.  see help merge

keep: overrides the default behavior (always using the nokeep option of
merge) and instead includes unmatched  observations from the using dataset.



Hope this helps
rajesh

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of hmjc66
Sent: 02 July 2007 16:49
To: statalist
Subject: Re: st: How to identify observations in Using file for further
analysis with "nearmrg" command

Sorry - there should not be "permno" in the nearmrg command. My
question still stands.

nearmrg using "C:\Using.dta", nearvar(var1) genmatch(var1bin);

Hugh


On 7/2/07, hmjc66 <hmjc66@gmail.com> wrote:
> Hi,
>
> My data is of the following type (see below). I am trying to find the
> closest match based on var1. I also need to analyze var2-var5 further
> for ONLY the matched observations in the Using file, but am unable to
> identify them.
>
> For example, lets say observations 7, 9, 11, 14 and 15 from Using file
> are matched respectively to 1, 2, 3, 4 and 5 from Master file based on
> var1. I want to only keep observations 7, 9, 11, 14 and 15 from the
> Using file for further analysis, but cannot identify them. Right now,
> my Master file contains var1bin after -nearmrg-, and I cannot tell
> which specific observations in the Using file have been picked. Can
> you please advise?
>
> Currently, my -nearmrg- program is as follows:-
>
> nearmrg using "C:\Using.dta", nearvar(var1) genmatch(var1bin);
>
> Thanks,
>
> Hugh
>
>
> Master
> id      var1
> 1
> 2
> 3
> 4
> 5
>
>
> Using
> id      var1    var2    var3    var4    var5
> 6
> 7
> 8
> 9
> 10
> 11
> 12
> 13
> 14
> 15
> 16
> 17
> 18
> 19
> 20
> *
> *   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/
>
*
*   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/

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

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index