File size: 3,188 Bytes
4328c38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79

**********************************************************************
*** TABLE A3
*** Impact of Trump Rallies on the Probability of a Black Stop: 
*** Alternative Methods to Deal with Multiple Rallies
**********************************************************************

use "Data\stoplevel_data.dta", clear

keep black dist* county_fips day_id

g TRUMP_0 = 0
forval ii = 1/9 {
replace TRUMP_0 = 1 if dist_event`ii' == 0
}

g TRUMP_POST_M30 = 0
forval ii = 1(1)9{ 
replace TRUMP_POST_M30 = 1 if (dist_event`ii' >=31 & dist_event`ii'!=.)
}
g TRUMP_PRE_M30 = 0
forval ii = 1(1)9{ 
replace TRUMP_PRE_M30 = 1 if (dist_event`ii' <=-31 & dist_event`ii'!=.)
}

g TRUMP_POST_1_30 = 0
		replace TRUMP_POST_1_30 = 1 if (dist_event1 >=1 & dist_event1<=30 & dist_event1!=.)
		replace TRUMP_POST_1_30 = 2 if (dist_event2 >=1 & dist_event2<=30 & dist_event2!=.)
		replace TRUMP_POST_1_30 = 3 if (dist_event3 >=1 & dist_event3<=30 & dist_event3!=.)
		replace TRUMP_POST_1_30 = 4 if (dist_event4 >=1 & dist_event4<=30 & dist_event4!=.)
		replace TRUMP_POST_1_30 = 5 if (dist_event5 >=1 & dist_event5<=30 & dist_event5!=.)
		replace TRUMP_POST_1_30 = 6 if (dist_event6 >=1 & dist_event6<=30 & dist_event6!=.)
		replace TRUMP_POST_1_30 = 7 if (dist_event7 >=1 & dist_event7<=30 & dist_event7!=.)
		replace TRUMP_POST_1_30 = 8 if (dist_event8 >=1 & dist_event8<=30 & dist_event8!=.)
		replace TRUMP_POST_1_30 = 9 if (dist_event9 >=1 & dist_event9<=30 & dist_event9!=.)

reghdfe black 1.TRUMP_0 1.TRUMP_POST_1_30 1.TRUMP_POST_M30 1.TRUMP_PRE_M30, a(i.county_fips i.day_id i.county_fips#c.day_id) cluster(county_fips day_id)
outreg2 using "Results\TableA3.txt", replace se bdec(3) sdec(3) rdec(3) coefastr alpha(0.01, 0.05, 0.10) symbol(***, **, *) bfmt(fc) addtext("Sample","Sum Event") keep(1.TRUMP_POST_1_30) label nonotes nocons noni

**************************
use "Data\stoplevel_data.dta", clear

keep black dist* county_fips day_id
g stopid = _n

g eventexists=0
forval ii=1/9 {
	replace  eventexists = eventexists+1 if dist_event`ii'!=.
}

expand eventexists, generate(copy)
sort stopid eventexists
by stopid eventexists: g number=cond(_N==1,0,_n)
replace number=1 if number==0 & dist_event1!=.
replace eventexists=1 if eventexists==0 
g invnrallies=1/(eventexists)
***
g dist_event=.
forval ii = 9(-1)1 {
	replace dist_event = dist_event`ii' if number==`ii' & dist_event==.
} 

g TRUMP_0 = 0
forval ii = 1/9 {
replace TRUMP_0 = 1 if dist_event == 0
}

g TRUMP_POST_1_30 = 0
replace TRUMP_POST_1_30 = 1 if (dist_event >=1 & dist_event<=30 & dist_event!=.)

g TRUMP_POST_M30 = 0
replace TRUMP_POST_M30 = 1 if (dist_event >=31 & dist_event!=.)

g TRUMP_PRE_M30 = 0
replace TRUMP_PRE_M30 = 1 if (dist_event <=-31 & dist_event!=.)

reghdfe black 1.TRUMP_0 1.TRUMP_POST_1_30 1.TRUMP_POST_M30 1.TRUMP_PRE_M30 [aweight=invnrallies], a(i.county_fips i.day_id i.county_fips#c.day_id) cluster(county_fips day_id)
outreg2 using "Results\TableA3.txt", append se bdec(3) sdec(3) rdec(3) coefastr alpha(0.01, 0.05, 0.10) symbol(***, **, *) bfmt(fc) addtext("Sample","Event Panel") keep(1.TRUMP_POST_1_30) label nonotes nocons noni