Statalist


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

Re: st: How to find a matching sample for a specified sample based on some standards?


From   Roy Wada <[email protected]>
To   [email protected]
Subject   Re: st: How to find a matching sample for a specified sample based on some standards?
Date   Tue, 13 Oct 2009 03:51:21 -0700

> I need to find a matching sample for my object sample.
> Its matching sample is chosen from a large sample based on some filtering standards that
> the object and its matching should be  in the same year, the same industry and the asset of
> the matching should  fluctuate at the 30% upper or lower than the object. If there are more than one

Try -anymatch- from ssc.

The wrinkle is your having to do it within the same year and industry.
In that case, keep within each group and append the result.

egen group=group(year industry)
save temp, replace
qui sum group
local max=`r(max)'
forval num=1/`max' {
  use temp, clear
  keep if group==`num'
  anymatch asset, id(id) metric(asset)
  save mystuff`num', replace
}

... and append those files together here ....

The distance will be automatically produced. Keep/drop the ones within
the 30% limit.

Roy

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



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index