----- Original Message -----
From: "Benoit Dulong" <[email protected]>
To: "statalist" <[email protected]>
Sent: Friday, August 22, 2003 10:54 AM
Subject: st: by & nearest
> Is it possible (change the program) to get nearest to work with by ?
>
> I can not find the answer in my NC151 notes.
>
> Thank you
>
> Benoit Dulong.
>
Beniot,
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')
}
Scott
*
* 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/