使用 SAS 导入时截断字符
我有一个包含公司数据和描述的 Excel 电子表格。有些单元格中基本上包含小型文章,单个单元格中包含一页又一页的纯文本。当我导入文件时,SAS 一直给我带来问题,因为它截断了一些较长的单元格,并且文本在句子中间被切断。关于如何避免这种情况的任何想法?我尝试将文件保存到制表符分隔的文本文件中,但没有成功。
谢谢!
I have an Excel spreadsheet with company data and descriptions. Some of the cells basically contain mini-essays in them, pages and pages of straight text contained in a single cell. SAS has been giving me problems when I'm importing the file because it truncates some of the longer cells and the text gets cut off mid-sentence. Any ideas on how to avoid this? I've tried saving the file to a tab-delimited text file, but no luck.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如您所说,导出到制表符分隔或 csv 可能是可行的方法。确保也将字符串括在引号中。但是您是否为包含长单元格的变量指定了长度?根据 SAS 的规定,最大长度为 32,767 个字符,因此也许可以尝试尽可能大的数字 - 希望小于该数字。
此外,lrecl(文件每行的最大长度)应指定为最大值 32767。
Exporting to tab-delimited or csv may be the way to go, as you said. Be sure to have strings enclosed in quotes also. But do you have the length specified for the variable containing the long cells? According to SAS the maximum length is 32,767 characters, so perhaps try as large a number as it takes -- hopefully less than that.
Also the lrecl (max length of each line of the file) should be specified with a max of 32767.
如果您拥有 SAS/ACCESS 许可证(此链接介绍了如何检查)。您可以使用库名称访问 Excel 电子表格 (此链接讨论 Excel 访问) 和 这是一篇很棒的论文,详细介绍了如何像 SAS 数据集一样获取 Excel 数据< /a>.
(但@Neil Neyman 的回答听起来也不错)
If you have a license for SAS/ACCESS (which this link explains how to check). You can use a libname to access the Excel spreadsheet (this link talks about Excel access) and this is a great paper which details how to get at the Excel data just like a SAS data set.
(but @Neil Neyman's answer sounds good too)