Bookmark and Share

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]

Re: st: RES: performace matching


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RES: performace matching
Date   Wed, 20 Apr 2011 23:53:44 +0100

A metaquestion is why no one answered this first time round. Perhaps
it seems an odd question to ask.

On this definition the match is either the id with next higher ROA or
that with the next lower ROA. You would need a rule about ties.
Nothing stops two ids being each other's match or there being more
than one id which matches equally well. This line of code may help.

bysort SIC year (ROA) : gen matchid =
          cond((ROA[_n+1] - ROA) <= (ROA - ROA[_n-1]) , id[_n+1], id[_n-1])

I don't know what -Suspect- is.

On Wed, Apr 20, 2011 at 8:53 PM, Fernando Caio Galdi
<fernando.galdi@fucape.br> wrote:
> ________________________________________
> De: owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] em nome de Fernando Caio Galdi [fernando.galdi@fucape.br]
> Enviado: quarta-feira, 13 de abril de 2011 2:14
> Para: statalist@hsphsun2.harvard.edu
> Assunto: st: performace matching
>
> Dear Statalister,
>
> I need to match each firm-year observation with another from the same industry code (SIC) and year with the closest return on assets (ROA) in the current year. My database has the following format:
>
> id        year        SIC        ROA        Suspect
> 1        2000        1           0.102         0
> 2        2000        1           0.122         1
> 3        2000        2           0.231         0
> 4        2000        2           0.091         0
> 5        2000        3           0.123         1
> ...
> 1        2001        1           0.145         1
> 2        2001        1           0.123         1
> 3        2001        2           0.099         0
> 4        2001        2           0.078         0
> 5        2001        3           0.269         0
> ...
>
> How can I find which firm is the matching for each firm by year and by each industry?
>

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