You may be able to use -nearmrg- to help with this. Type -ssc describe
nearmrg- You would need to deal with tied values of BookValue in the
Non-event firms table since -nearmrg- requires the merging value to be
unique in the lookup dataset, but you would need to deal with ties in any
approach you selected.
Michael Blasnik
(author of nearmrg)
----- Original Message -----
From: "Ingo Brooks" <[email protected]>
To: <[email protected]>
Sent: Wednesday, February 07, 2007 3:45 AM
Subject: st: Size matching
> Dear all,
>
> I have two datasets with yearly firm data. Sample 1 is the dataset
> containing the event firms (Initial public offerings (IPO) and
> seasoned public offerings (SEO)) and sample 2 contains the non-event
> firms (i.e. all firms which did not have an IPO or SEO in the last
> five years).
>
> The datasets are structured as follows:
>
> Dataset 1: Event firms
>
> ID Year BookValue E_Ret
> E1 1995 670 12
> E2 1995 380 -8
> E3 1995 1120 -4
> E1 1996 682 9
> E3 1996 1120 -2
>
>
> Dataset 2: Non-event firms
>
> M_ID M_Year M_BookValue M_Ret
> M1 1995 350 13
> M2 1995 430 12
> M3 1995 690 8
> M4 1995 890 -2
> M5 1995 1200 11
> M1 1996 350 8
> M2 1996 430 6
> M3 1996 690 -5
> M4 1996 890 4
> M5 1996 1200 10
>
>
> What I now would like to do is to match the Non-event firms with the
> event firms. In doing so, I would like to match the firms by aid of
> variable "BookValue". Specifically, I would like to obtain for each
> event firm the non-event firm whose BookValue is closest to but bigger
> than that of the event firm. As a result, I should obtain the
> following dataset:
>
>
> Dataset Final: Matched firms
>
> ID Year BookValue ERet M_ID M_BookValue MRet
> E1 1995 670 12 M3 690 8
> E2 1995 380 -8 M2 430 12
> E3 1995 1120 -4 M5 1200 11
> E1 1996 682 9 M3 690 -5
> E3 1996 1120 -2 M5 1200 10
*
* 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/