今天看啥  ›  专栏  ›  Stata与R学习

Stata学习:如何构建美国地区工作场所禁烟法律变量?

Stata与R学习  · 知乎专栏  ·  · 2024-02-01 09:59
文献来源Gao, H., Hsu, P.-H., Li, K., & Zhang, J. (2020).The Real Effect of Smoking Bans: Evidence from Corporate Innovation. Journal of Financial and Quantitative Analysis, 1–88.清洗数据cd C:\Download import exc gao2018, clear drop in 1 compress keep A D drop if mi(D) replace A = upper(A) ren A state_name save 0, replace * use 美国地区异常温度, clear keep s* duplicates drop merge m:m state_ using 0, nogen replace state = "DC" if regexm(state_,"DIST") order state so state forv i = 2000/2022{ g y`i' = `i'>=D & !mi(D) } gather y* drop D ren val SmokeFree g year = substr(v,2,.) drop v destring y, replace compress la var S 美国地区工作场所禁烟法律 save 美国地区工作场所禁烟法律, replace d ta y S 得到结果Contains data from 美国地区工作场所禁烟法律.dta Observations: 1,173 Variables: 4 1 Feb 2024 09:58 ----------------------------------------------------- ………………………………

原文地址:访问原文地址
快照地址: 访问文章快照