SAS proc 导入缺少前导零
我正在尝试使用 proc import ( SAS ) 将数字从 csv 文件导入到 sas 数据集,但导入后所有前导零都消失了。
例如,
导入后“0123456”我只会得到“123456”
I am trying to import numbers from csv file to sas dataset with proc import ( SAS ) , but all my leading zero are disappear after the import.
For example,
'0123456' after import I would get only '123456'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您将它们作为数字字段读取,则只需对变量应用一种格式即可显示前导零。请记住,数字 012345 相当于数字 12345,因此没有理由存储前导零。尝试一下格式
. To display the zero in your example above.
If you really need the zeroes for some reason, and the number of digits is arbitrary, then you need to read them in as character variables instead.
If you are reading them in as numerical fields, you just need to apply a format to the variable to display the leading zeroes. Remember, the number 012345 is equivalent to the number 12345 so there's no reason to store the leading zero. Try the format
. To display the zero in your example above.
If you really need the zeroes for some reason, and the number of digits is arbitrary, then you need to read them in as character variables instead.