Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Re: by & nearest


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Re: by & nearest
Date   Tue, 26 Aug 2003 11:25:29 +0100

Scott Merryman replied to Benoit Dulong 
 
> > Is it possible (change the program) to get nearest to 
> work with by ?

> Rather than changing the program you could use foreach to 
> call -nearest- for
> each group.
> 
> Example:
> 
> levels id, local(levels)
> foreach l of local levels {
>      nearest x y if idrep == `l' , id(idpoint`l') dist(h`l')
>       }
> 

To expand a bit on Scott's reply: 

You can do it. See help -byable-. 

It's not on my agenda, even though it is  
a minor change. As Michael Blasnik has 
pointed out previously, -nearest- is not nearly 
so fast as a program he wrote himself. 
Therefore, it's that program which should 
be improved (if it doesn't support this 
already).  

Meanwhile, as Scott indicated, -foreach- 
with -levels- is one way to -by:-it-yourself. 

Nick 
[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