1 Star 0 Fork 2

kerrydu/statamacroe

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
capital.do 1.45 KB
一键复制 编辑 原始数据 按行查看 历史
kerrydu 提交于 2021-07-09 19:39 . 0
cd "E:\xmuONE\OneDrive - xmu.edu.cn\Desktop"
import excel using "E:\xmuONE\OneDrive - xmu.edu.cn\Desktop\fix.xlsx",clear
drop in 2/77
sxpose,clear
renvars _var2-_var19 \ gdp2000-gdp2017
drop in 1
reshape long gdp,i(_var1) j(year)
replace _var = subinstr(_var1,":固定资产投资","",.)
rename _var province
destring,replace
compress
save invest
import excel using "E:\xmuONE\OneDrive - xmu.edu.cn\Desktop\invprice.xlsx",clear
gen flag=_n if strpos(A,"01dec2000")
replace flag=flag[_n-1] if missing(flag)
keep if _n>=flag | _n==1
drop flag
sxpose,clear
renvars _var2-_var21\ price2000-price2019
drop in 1
rename _var1 province
replace province=subinstr(province,"固定资产投资价格指数:","",.)
reshape long price, i(province) j(year)
destring, replace
merge 1:1 province year using "E:\xmuONE\OneDrive - xmu.edu.cn\Desktop\invest.dta"
keep if _merge==3
drop _merge
/*
set trace off
chaintobase price, t(year) id(province) base(2000) gen(price2)
rename gdp inv
replace inv=inv/price2
set trace off
calk inv, gen(K) first(5) delta(0.1) t(year) id(province)
*/
replace price=1 if year==2000
bys province (year): replace price=price*price[_n-1]/100 if _n>1
rename gdp inv
replace inv = inv/price
local delta=0.1
bys province (year): gen g=(inv[5]/inv[1])^(1/4)-1
cap drop K
local delta=0.1
*bys province (year): gen K=inv[1]/(1-`delta'-g)
bys province (year): gen K=inv[1]/(`delta'+g)
bys province (year): replace K=K[_n-1]*(1-`delta')+inv if _n>1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
其他
1
https://gitee.com/kerrydu/statamacroe.git
[email protected]:kerrydu/statamacroe.git
kerrydu
statamacroe
statamacroe
master

搜索帮助