*** Prepare frequency translation table
use frequency politics using "$dir_root/data/directories/uk_1895_directory", clear

gen num_total=1

* by frequency
gen num_daily=(frequency=="d")
gen num_weekly=(inlist(frequency,"w","tw","thrice"))
gen num_other=(num_daily==0 & num_weekly==0)


*by type
gen num_conservative=(politics=="Conservative")
gen num_liberal=(politics=="Liberal")
gen num_independent=(politics=="Independent")
gen num_neutral=(politics=="Neutral")
gen num_other_missing=(num_conservative==0 & num_liberal==0 & num_independent==0 & num_neutral==0)


collapse (sum) num_*

label var num_total "Total"
label var num_daily "Daily (4+ times per week)"
label var num_weekly "Weekly (1-4 times per week)"
label var num_other "Other/Unknown"

label var num_conservative "Conservative"
label var num_liberal "Liberal"
label var num_independent "Independent"
label var num_neutral "Neutral"
label var num_other_missing "Other/Unknown"


cd "$dir_root/Results" 

sutex num_daily num_weekly num_other num_total num_conservative num_liberal num_independent num_neutral num_other_missing num_total, labels file(T3_UK_Directory_stats) replace
