Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: RES: performace matching
From
Nick Cox <[email protected]>
To
[email protected]
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
<[email protected]> wrote:
> ________________________________________
> De: [email protected] [[email protected]] em nome de Fernando Caio Galdi [[email protected]]
> Enviado: quarta-feira, 13 de abril de 2011 2:14
> Para: [email protected]
> 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/