• 2023-06-24STATA collapse详解
    //分类汇总//stata中collapse的用法////stata中的collapse命令是一种重新整理数据的有效工具,它可以将多个变量和水平的多维数据表合并成一个维度的数据表。它的语法格式如下:////collapse[varlist][,by(varlist)][ifexp][weight][usingfilename]////其中,va
  • 2023-06-23stata rencode源码
    *rencode*Programtoencodevariableandreplaceoriginalasdesired.*Likeencode,butcanspecifyreplaceoptioninsteadofgenerate(name).*Thisprogramalsocompressesthegeneratedvariabletoamoreefficientdatatypeifpossible.*KennethL.S
  • 2023-04-22stata 程序写法 静态运行写法
    programmysum,rclasssyntaxvarnamereturnlocalvarname`varlist'tempvarnewquietly{countif!missing(`varlist')returnscalar
  • 2023-04-18STATA 遍历查找
    sscinstallelabel,replacesysuseauto,clearused:\statashu\2\cgss2015,clearforeachvofvarlist_all{cap:sdecode`v',replace}usecgss2015-2,replacelocalk=_Nforeachvarofvarlist_all{locala:varlabel`var'//disp&qu
  • 2023-04-18STATA 遍历变量名 标签内容 变量值
    sysuseauto,clearlevelsofforeign,local(levels)foreachxoflocallevels{diinyellow"`x'isauniquevalueofrep78"}//遍历各个变量的标签及变量值sysuseauto.dta,clearlocalk=_Nforeachvarofvarlist_all{locala:varlabel`var'