Dear Stata Users,

Please help me with the following issue. I have the data below where “gvkey” is a firm identifier, “fyear” fiscal year, “investigation” – is the number of consecutive years that a firm is under investigation, “score” is the level of firms reputation (increases with the rating). Can you please help me to estimate hazard model in order to investigate how long a firm stays under consecutive investigation given its level of reputation?


Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str6 gvkey double fyear float(score investigation)
"001004" 1991   .36668235 .
"001004" 1995    .4518225 .
"001004" 1996    .4366576 .
"001004" 1997     .280829 .
"001004" 1998    .3167331 .
"001004" 1999     .335123 .
"001004" 2000    .3013004 .
"001004" 2001   .23537242 .
"001004" 2002   .21780014 .
"001004" 2009   .21538855 .
"001004" 2010     .121961 .
"001004" 2012   .11789893 .
"001004" 2013   .11486743 .
"001004" 2014   .03917819 .
"001009" 1991   .56247663 .
"001009" 1992    .6663252 .
"001009" 1993    .5548004 .
"001009" 1994   .42482805 .
"001013" 2009   .20085655 .
"001013" 2010   .19832867 1
"001034" 1995     .335645 .
"001034" 1996   .37798005 .
"001034" 1997     .327492 .
"001034" 1998    .3499495 .
"001034" 1999   .31942976 .
"001034" 2000   .26431492 .
"001034" 2001   .21923172 .
"001034" 2002   .18681677 .
"001034" 2003   .25946015 .
"001034" 2004    .2178607 .
"001034" 2005    .1680248 .
"001034" 2006   .05781454 .
"001034" 2007   .10863132 .
"001036" 1997    .3856214 .
"001036" 1998    .4827335 .
"001036" 1999     .486646 .
"001036" 2000    .3767102 .
"001054" 1992    .3006461 .
"001054" 1993    .2401931 .
"001056" 1999   .26364315 .
"001056" 2000   .19708097 .
"001056" 2001   .17716374 1
"001056" 2002   .13572516 .
"001056" 2003    .1204003 .
"001056" 2004   .05706221 .
"001056" 2005   .04770107 .
"001056" 2006   .02454672 .
"001072" 1998   .25798723 .
"001072" 1999   .21268784 1
"001072" 2000   .15877776 2
"001072" 2001   .13009542 .
"001072" 2002    .0965055 1
"001072" 2003   .11057298 .
"001072" 2004  .029707603 .
"001072" 2014 -.027464435 .
"001078" 2015  -.02274275 .
"001081" 2006    .2030514 .
"001094" 2004   .07574526 1
"001094" 2005   .02113352 2
"001098" 1994    .4703032 .
"001111" 1995   .25531545 .
"001111" 1996   .27745888 1
"001111" 1997   .19730458 2
"001111" 1998   .27300152 3
"001111" 2000    .2488593 .
"001111" 2001    .2180557 1
"001111" 2002   .13977523 2
"001111" 2003   .10051212 3
"001111" 2004  .035940673 4
"001111" 2005   .02341726 5
"001111" 2006 -.010462924 6
"001111" 2007  -.02659348 7
"001115" 1994   .20663323 .
"001115" 1995    .1979103 .
"001115" 1996   .24134396 .
"001115" 1997    .1859536 .
"001115" 1998   .19416074 .
"001115" 1999    .2138665 .
"001128" 1991   .23618147 .
"001128" 1992   .27059516 .
"001128" 1993   .23983558 .
"001137" 1992   .26680586 .
"001137" 1993   .25499123 .
"001137" 1994    .3910683 .
"001161" 1991    .4323609 .
"001161" 1992    .3272092 .
"001161" 1993   .16602276 .
"001161" 1994    .3504707 .
"001161" 1995    .4481675 .
"001161" 1996    .4903389 .
"001161" 1997    .4061499 .
"001161" 1998    .3635488 .
"001161" 1999    .3368285 .
"001161" 2000   .23540454 .
"001161" 2001   .18785053 1
"001161" 2002    .1365453 .
"001161" 2003    .2024944 1
"001161" 2004    .1574431 .
"001161" 2005   .12169088 .
"001161" 2006    .0644054 1
end