Code:
input str1 firm int year float(profits) "a" 2000 . "a" 2001 . "a" 2002 . "a" 2003 5 "a" 2004 10 "a" 2005 15 "b" 2000 20 "b" 2001 25 "b" 2002 30 "b" 2003 35 "b" 2004 40 "b" 2005 45 "c" 2000 . "c" 2001 . "c" 2002 5 "c" 2003 15 "c" 2004 . "c" 2005 . end
"a" is the suitable one, since "b" reported profits at least 2 times in the pre-reg period it cannot be considered. For "c", it failed to report profits during the post-reg period at least 2 times, hence it must not be considered.
Code:
*I tried various commands that I collated from previous posts in stata encode firm,gen(id) xtset id year gen regulation=. replace reg= 1 if year <2003 replace reg =2 if year>2002 egen dummy1=count(profits) if year<2003,by(id ) // for counting profits by id during the pre_reg gen indicator = dummy1 > 2 & !missing(dummy1) // to specify those firms which reported profits greater than 2 times egen dummy2=count(profits) if year>2002,by(id ) // for counting profits by id during the post_reg gen indicator2 = dummy2 > 2 & !missing(dummy2) // to specify those firms which reported profits greater than 2 times gen mand_firm=1 if indicator==0 & indicator2==1 // for mandatory firms *in the above code, both "a" & "b" will be given the dummy "1" since this command can't exclude "b"
0 Response to classification of firms into groups based on some criterion
Post a Comment