Statalist


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

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   st: How to find a matching sample for a specified sample based on some standards?
Date   Tue, 13 Oct 2009 15:48:31 +0800

Dear statalists,
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 matching observation for any of the object sample, choose the one with the closest asset. If there is no matching observation for any of the object sample, then the filetering standards have to be relaxed, just choose the same year and the closest asset within 30% of the object observation. Based on the standards, the one with no mathcing observation will be marked as missing value.

To clarify my expression, I take an example in the following.

*the object sample
input code year ind asset
1 2001 A 100
2 2002 B 200
3 2004 D 400
4 2001 C 100
end



* the large sample from which choose the matching sample for the object sample.
input code year ind asset
7 2003 A 120
12 2002 B 230
13 2001 A 150
11 2001 A 110
18 2002 B 220
 end

I need the resulting  sample after mathcing.

objectcode year objectind objectasset matchingcode matchingind mathcingasset
1 2001 A 100 11 A 110
2 2002 B 200 12 B 220
3 2004 D 400 . . .
4 2001 C 100 11 A 110

How to realize that?

thank you for any help.


Best regards,
Rose.


 

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