美文网首页
如何把excel数据批量转为stata数据

如何把excel数据批量转为stata数据

作者: 松柏林stata | 来源:发表于2021-01-27 21:28 被阅读0次
    local files: dir "." file "*.xlsx", respectcase
    foreach file in `files' {
    import excel using "`file'", describe
       forvalues i = 1/`r(N_worksheet)' {
          import excel using "`file'",    sheet("`r(worksheet_`i')'")    ///
          cellrange(`r(range_`i')')     firstrow  clear
    save `file'.dta, replace
      }  
    }
    

    相关文章

      网友评论

          本文标题:如何把excel数据批量转为stata数据

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