Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down at the end of May, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Gordon Hughes <G.A.Hughes@ed.ac.uk> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: Re: Identify 5 closest observations of a variable |

Date |
Tue, 18 Sep 2012 10:39:12 +0100 |

Gordon Hughes g.a.hughes@ed.ac.uk ================================ Dear Statalisters, The data below shows three variables:- region, var1 and var2. For each observation in a given region, I want the 5 closest observations based on var1 (not counting the observation in question). I basically need the average value of var2 for the 5 observations that are identified. I don't have any missing values in my data for all three variables below. I can also confirm that I have a few regions with less than 6 observations each; hence these regions will be ignored. I am using Stata 12. Thanks, Joe * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

- Prev by Date:
**st: Re: Maximizing under constraint with Mata?** - Next by Date:
**st: Re: standardized coefficients from a probit model for path analysis using -listcoef-** - Previous by thread:
**st: Re: Maximizing under constraint with Mata?** - Next by thread:
**st: odbc load from SQL if ID is in my Stata master dataset?** - Index(es):