全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
2970 2
2013-08-03
字符型变成数值型 encode和string有何区别?应该如何写命令?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2013-8-3 16:46:56
看看
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2013-8-4 10:22:57
encode is designed for situations in which you have a string variable, typically containing meaningful nonnumeric text (e.g., male, female), and wish to have the equivalent information as a numeric variable with labels. This goes way back in Stata history.

destring is designed for situations in which you have a string variable, typically containing meaningful numeric text (e.g., 1, 2), which you wish to convert to the numeric variable it should properly be. Usually, that variable is now string because of some mistake. Perhaps the mistake was yours, because what you initially typed in Stata's Data Editor was nonnumeric. Or, perhaps the numeric text is contaminated by nonnumeric text from some earlier operation (e.g., in a spreadsheet), and Stata spotted that.
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群