美文网首页研究设计与规范
stata--do file规范编写格式

stata--do file规范编写格式

作者: 古城路揸fit人 | 来源:发表于2019-09-25 13:58 被阅读0次

    数据清理时的代码格式

    *************CHNS CONSUMPTION DATA************
    *auther: Jamin
    *email : xxx@163.com
    /*行业cpi、工业cpi:缺失值用前后两期的平均值替代*/
    foreach var of varlist hhinc_cpi hhincpc_cpi indinc_cpi{ 
    sum `var'
    sort idind wave
    by idind:replace `var'=(`var'[_n+1]+`var'[_n-1])/2  if `var'==. 
    }
    

    数据分析的代码规范

    *************CHNS CONSUMPTION DATA************
    *auther: Jamin
    *email : xxx@163.com
    *********************************************************IV估计***********************************************
    /*
    note:核心变量
    y:ln_Ave_Net_Income poverty_cn_total poverty_worldbank
    x:house_certification 
    mechanism:nonfarmemployee
    group:Ave_Area
    control:
    global hd "HD_Age  HD_Edu HH_FemHead"
    global family "Ave_Area HH_Pop  HH_Altitude disaster01 Yield HH_Dai _Transfer"
    global village "Dis_County  Dis_Factory Market Bank    Num_Pop  Water_Supply  Transport_Cost"
    */
    
    /*父亲外出务工样本*/
    reg chn migration if father==1
    
    /*母亲外出务工样本*/
    reg chn migration if mother==1
    

    相关文章

      网友评论

        本文标题:stata--do file规范编写格式

        本文链接:https://www.haomeiwen.com/subject/elrsuctx.html