我在 Stata 中的变量采用以下形式:
First Name: Allen
Last Name: Von Schmidt
Birth Year: 1965
County: Cape May
State: New Jersey
First Name: Lee Roy
Last Name: McBride
Birth Year: 1967
County: Cook
State: Illinois
我想超出它们以在 .txt 中创建逗号分隔的行:
Allen,Von Schmidt,1965,Cape May, New Jersey
Lee Roy,McBride,1967,Cook, Illinois
我怎样才能使用 outsheet (或其他命令)来做到这一点?我需要先将数字变成字符串吗?我需要先为每个变量添加逗号吗?谢谢!
会像以下工作吗?
outsheet first last birth_year county state using FileName.txt, comma nolabel noquote
如果我想做同样的事情但变量是“”分隔的,我会删除以前的stata代码中的noquote吗?
例如,假设我可能想要一个输出:
"Allen","Von Schmidt","1965","Cape May","New Jersey"