如何在 MAC 上读取/转换 SAS Gov't Data 文件?

发布于 2024-08-07 10:29:31 字数 161 浏览 5 评论 0 原文

有政府数据文件:http://www.cdc.gov/EpiInfo/

这种奇怪的 SAS 格式。我怎样才能将它们转换为 XML/CSV,这样更简单,可以通过脚本/等读取?

There are gov't data files: http://www.cdc.gov/EpiInfo/

Available in this weird SAS format. How can I convert them into XML/CSV, something much simpler that can be read by scripts/etc.???

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

醉南桥 2024-08-14 10:29:31

我也遇到了同样的问题,所以我做了一个简单的SAS数据查看器。您可以从此处的下载部分下载它:http://code.google.com/p/sasquatch

它具有许多与 SAS Universal Viewer 相同的功能,但仍在进行中。

您需要安装 Adob​​e AIR,您可以在 adobe 网站上获取它。

I had the same problem, so i made a simple SAS data viewer. You download it from the downloads section here: http://code.google.com/p/sasquatch

It has alot of the same features as SAS Universal Viewer, but its still a work in progress.

You need to have Adobe AIR installed, you can get that on the adobe website.

知足的幸福 2024-08-14 10:29:31

数据是 SAS XPORT (.xpt) 还是 .sas7bdat 格式?

Are the data in the SAS XPORT (.xpt) or .sas7bdat format?

橪书 2024-08-14 10:29:31

为了将来参考,可以使用 R 的“SASxport”包读取和写入 SAS XPORT 文件(http://cran.r-project.org/web/packages/SASxport/index.html)。

For future reference, SAS XPORT files can be read and written using the 'SASxport' package for R (http://cran.r-project.org/web/packages/SASxport/index.html).

你的呼吸 2024-08-14 10:29:31

(已将此发布到 superuser.com)

SAS Institute(生产 SAS 的公司)制作了一个 SAS 数据集查看器

请注意,SAS 程序文件通常具有扩展名 .sas,而数据文件本身通常具有扩展名 .sas7bdat

编辑:我后来注意到你的标题说是在 Mac 上运行的,所以这可能没有多大帮助,因为我相信该工具仅适用于 Windows。)

(Already posted this to superuser.com)

SAS Institute (the company that makes SAS) produces a viewer for SAS data sets.

Note that SAS program files usually have the extension .sas, whereas the data files themselves usually have the extension .sas7bdat.

(EDIT: I notice belatedly that your title says on a Mac, so this may not help much as I believe the tool is Windows only.)

花伊自在美 2024-08-14 10:29:31

这里有一个快速而肮脏的 python 五行代码,用于将 SAS .xpt(又名 XPORT)文件转换为 .csv

import pandas as pd
FILE_PATH = "(fully qualified name of directory containing file)"
FILE = "ABC"  # filename itself (without suffix)

# Note: might need to substitute the column name of the index (in quotes) for "None" here

df = pd.read_sas(FILE_PATH + FILE + '.XPT', index=None)

df.to_csv(FILE_PATH + FILE + '.csv')

希望这可以帮助某人

Here a quick-and-dirty python five-liner to convert a SAS .xpt (aka XPORT) file to .csv

import pandas as pd
FILE_PATH = "(fully qualified name of directory containing file)"
FILE = "ABC"  # filename itself (without suffix)

# Note: might need to substitute the column name of the index (in quotes) for "None" here

df = pd.read_sas(FILE_PATH + FILE + '.XPT', index=None)

df.to_csv(FILE_PATH + FILE + '.csv')

Hopefully this might help someone

薄情伤 2024-08-14 10:29:31

JMP在MAC上运行并且可以读取sas文件。请访问 jmp.com 了解更多信息。

JMP runs on MAC and can read sas files. Visit jmp.com for more information.

强辩 2024-08-14 10:29:31

你的问题有两个部分
1. 阅读这些文件
2. 转换这些文件
我查看了您共享的链接,没有直接可下载的文件,但我假设您指的是 Windows 的文件。

  1. 要查看,您可以使用以下内容
    一个。 SAS 通用查看器:https://support.sas.com/downloads/package。 htm?pid=667
    b.在mac上使用SAS直接读取文件

  2. 要进行转换,您可以执行以下操作
    一个。使用SAS proc import导出和proc导出导出文件功能,
    b.为此使用第三方软件,例如 DBMSCopy;
    c.下载 JMP 试用版并将文件转换为所需格式(例如 CSV/txt 等)并完成使用。

There are two parts to your question
1. Read these files
2. Convert these files
I looked into the link you shared there are no directly downloadable files, but I am assuming that you mean the files for windows.

  1. For viewing you can use the folloiwng
    a. SAS Universal viewer: https://support.sas.com/downloads/package.htm?pid=667
    b. Use SAS on mac to directly read the files

  2. For conversion you can do the following
    a. Use SAS proc import to export and proc export to export the files feature,
    b. Use third party softwares, e.g., DBMSCopy for this;
    c. Download trial version of JMP and convert the files to desired format, e.g., CSV/txt etc and get done with it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文