今天看啥  ›  专栏  ›  momo

Stata学习:CSMAR对外投资数据库!

momo  · 知乎专栏  ·  · 2024-06-29 20:42

文章预览

数据来源:国泰安。 清洗数据 cd C : \ Download \ 1 fs *. zip foreach f in ` r ( files ) '{ unzipfile ` f ' } * fs *. xlsx foreach f in ` r ( files ) '{ import excel using "`f'" , first clear qui { labone , n ( 1 ) drop in 1 / 2 cap ren Symbol Stkcd cap g year = substr ( EndDate , 1 , 4 ) cap order year cap order Stkcd qui foreach v of var * { cap destring ` v ', replace } sca f_temp = "`f'" loc fname = usubinstr ( f_temp , ".xlsx" , "" , . ) compress } di ".........................................." save "`fname'.dta" , replace d cap g year = 0 ta year , m } 得到结果 Contains data from iv_equityiv.dta Observations: 47,219 Variables: 21 29 Jun 2024 20:39 -------------------------------------------------------------------------------------------- Variable ………………………………

原文地址:访问原文地址
快照地址: 访问文章快照
总结与预览地址:访问总结与预览