X hits on this document

# click on “Load Preferences”; (4) click on “Factory Settings.” If the ... - page 31 / 44

429 views

0 shares

31 / 44

qui sum `val'rep if stnum == `st' & year>1988 &

year<2003

local reps = r(sum)

qui sum `val'dem if stnum == `st' & year>1988 &

year<2003

local dems = r(sum)

local total = `reps' + `dems'

local demp = (`dems'/`total') * .25

local total_percent = `total_percent' + `demp'

}

qui count if demgov == 1 & stnum == `st' & year>1988 &

year<2003

local demgs = r(N)

qui count if stnum == `st' & year>1988 & year<2003

local totalg = r(N)

local gov_per = (`demgs'/`totalg') * .5

local total_percent = `total_percent' + `gov_per'

replace dem_strength = `total_percent' if stnum == `st' &

year>1988 & year<2003

}

The following commands were helpful in generating Democratic Control of a state’s government:

To recode a variable that ranged from 0 to 1 (and assumed any value in between) into just 0 and 1, I typed the following:

recode demcont (.0001/.5 = 0) (.5001/1.0 = 1)  Note: the recode command does not recognize “<” and “>.”  To create and recode a variable that comprises several variables (e.g., Democratic control includes both houses of the legislature plus the governorship):

gen lhdempc= lhdempro

recode  lhdempc (.0000/.5 = 0) (.5001/1 = 1)

gen uhdempc= uhdempro

recode  uhdempc (.0000/.5 = 0) (.5001/1 = 1)

gen demcont =  lhdempc +  uhdempc + demgov

recode demcont (.0001/2.999 = 0) (3 = 1)

The following commands were to convert sptaxrat from fiscal to calendar years.

bysort state year: assert _n==1

by state: gen sptaxratcal = .75*sptaxrat + .25*sptaxrat[_n+1]if _n < _N

The do file below is for creating a margin of victory variable

for margins of 3% or less

gen margin=.

replace margin= abs(diff)

gen margin3less=.

replace margin3less=1 if margin<.03001

 Document views 429 Page views 493 Page last viewed Sat Dec 10 00:51:51 UTC 2016 Pages 44 Paragraphs 843 Words 17107