英文:
Standardize multiple variables
问题
需要使用Stata标准化文本文件中的数百个变量,其中第一列是id
,随后的列是varlist。转换后,需要将只包含id
(第一列)和所有标准化值的新文件导出到我的目录。
英文:
I need to standardize hundreds of variables in a text file that has id
as first column and varlist in subsequent columns using Stata. After conversion, I need to export the new file that only has id
(first column) and all standardized values to my directory.
答案1
得分: 1
可能
ds id, not
foreach v in r(varlist)' { tempvar work egen
work' = std(v') drop
v'
rename work'
v'
}
查看 `help egen` 以确认其标准化方法是否与你的匹配
```
<details>
<summary>英文:</summary>
Possibly
ds id, not
foreach v in r(varlist)' {
work' = std(
tempvar work
egen v')
v'
drop
rename work'
v'
}
See `help egen` to check that its idea of standardization matches yours
</details>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论