Statalist


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

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


From   gjhxmu@sina.com
To   statalist<statalist@hsphsun2.harvard.edu>
Subject   Re: Re: st: How to find a matching sample for a specified sample based on some standards?
Date   Tue, 13 Oct 2009 21:17:49 +0800

Roy,

thank you for your reply and help.

-anymatch- does a good work. However, maybe there is still a problem.

In my posting, I need to find a matching observation from the large sample for each of the object sample. Following -anymatch-  may result in one observation in the object sample matches the other one also from the obejct sample, which is not what I need.

Hope for any help.



Best regards,

Rose.


----- Original Message -----
From: Roy Wada <roywada@gmail.com>
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: How to find a matching sample for a specified sample based on some standards?
Date: 2009-10-13 18:51:21

> 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 爄n the same year, the same industry and the asset of
> the matching should 爁luctuate 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/

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