We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(7)
如果您可以使用 Python,我刚刚发布了一个库,它可能可以帮助您这。转储到 CSV 看起来像这样(未经测试):
文件被视为流,因此文件有多大并不重要(只要你不调用 reader.record_count(),它必须寻求到文件末尾)。
如果您尝试这样做,请告诉我 - 该库对我有用,但我还没有在许多 .xpt 文件上尝试过。
If you can use Python, I've just published a library that might be able to help with this. Dumping to a CSV would look something like this (untested):
The files are treated as streams, so it shouldn't matter how large the file is (as long as you don't call reader.record_count(), which has to seek to the end of the file).
Let me know if you try this -- the library works for me, but I haven't tried it on many .xpt files yet.
谷歌搜索转换“convert sas to csv”出现此链接,它指向几个可能的解决方案。
AM统计软件是美国研究院出品的免费统计软件,貌似可以导入SAS传输文件,并输出约 150 种不同格式的文件。我猜
.csv
就在其中!Googling convert "convert sas to csv" turned up this link, which points to a couple of possible solutions.
AM Statistical Software is free statistical software produced by the American Institutes for Research that looks like it can import SAS transport files, and output files in ~150 different formats. I'd guess that
.csv
is among them!我相信 R 中的一个或多个包中有一个 read.xport 函数可以读取 SAS 传输文件。从那里您可以使用诸如
write.csv
之类的东西来保存它。I believe there is a
read.xport
function in one or more packages in R that will read SAS transport files. From there you can use something likewrite.csv
to save it out.Python 有 xport 库 https://pypi.python.org/pypi/xport/
安装库
Python has xport Library https://pypi.python.org/pypi/xport/
install library
为了避免读者浪费时间,我会说我刚刚尝试过 AM 统计软件(版本 0.06.04 Beta,2011 年 8 月 14 日)。它接受各种各样的 SAS 文件,但不接受 .xpt 。
To save readers wasting their time, I'll say that I've just tried AM Statistical Software (version 0.06.04 Beta Aug 14 2011). It accepts an impressive variety of SAS files, but not .xpt .
不幸的是,我太新了,无法发表评论,并且已经有一段时间没有活跃了,但我发现 AM 包运行得很好。
您需要从他们的网站下载一个单独的扩展,经过试验,我发现您需要选择文件类型“SAS Transport (*.v5x)”,转到目录,然后手动输入文件名相应的框。它将正确加载。
加载文件的方式有点奇怪,但根据我的需要,它的工作原理就像人们在其网站上声称的那样。
Unfortunately, I'm too new to comment, and this hasn't been active in a while, but I've found that the AM package works perfectly.
You need to download a separate extension from their site, and after experimenting, I've found that you need to select the file type "SAS Transport (*.v5x)", go to the directory, and MANUALLY type in the file name in the respective box. It'll load correctly.
Kind of a weird way to load the file in, but from what I've needed, it works just as people claim on their website.
我意识到这个线程已经很老了。这是我刚刚找到的最好的一个,并且有几个很好的建议。我想为其他可能寻找从 XPT 转换为 CSV 的简单方法的人添加另一个免费选项。
SAS 制作了 SAS 通用查看器,可以打开多种文件类型进行查看。它还会将文件保存为 CSV 格式。我尝试过的唯一文件类型是 XPT,它非常简单且快速。
SAS 网站下载链接:https://support.sas.com/ downloads/browse.htm?cat=74
根据版本 1.3 的用户指南:
使用 SAS Universal Viewer,您可以查看以下类型的文件:
• SAS 数据集,包括在 Windows 以外的平台上创建的数据集
• SAS v5 传输文件
• SAS 程序、日志和列表
• 常规文本文件
• HTML 和其他文件在 Internet Explorer 中打开的文件类型
https://support.sas.com/documentation/cdl/en/univiewerug/65066/PDF/default/univiewerug.pdf
I realize this thread is quite old. It was the best one I found just now and had several good suggestions. I wanted to add another free option for anyone else who might search for a simple way to convert from XPT to CSV.
SAS makes the SAS Universal viewer that will open several file types for viewing. It will save the file to the CSV format as well. The only file type I tried was XPT and it was incredibly simple and fast.
Link to SAS website for the download: https://support.sas.com/downloads/browse.htm?cat=74
According to the User's Guide for version 1.3:
With SAS Universal Viewer, you can view the following types of files:
• SAS data sets, including those that were created on platforms other than Windows
• SAS v5 transport files
• SAS programs, logs, and listings
• general text files
• HTML and other file types that open in Internet Explorer
https://support.sas.com/documentation/cdl/en/univiewerug/65066/PDF/default/univiewerug.pdf