简体   繁体   English

在 SAS Studio 中将 Freq 处理为数据集

[英]Proc Freq into a dataset in SAS Studio

I have a data (colour) that looks something like我有一个看起来像的数据(颜色)

Id haircolour 1 black 2 brown 3 grey ..... Id 发色 1 黑色 2 棕色 3 灰色 .....

And using proc freq I got a table that looked like并使用proc freq我得到了一张看起来像的表

Haircolour Frequency Black 10 Brown 20 Grey 30发色频率 黑色 10 棕色 20 灰色 30

Is there any way for me to save this table as a new sas file with haircolour and frequency as the variables?有什么办法可以让我将此表保存为一个新的 sas 文件, haircolourfrequency作为变量?

Thanks Tim谢谢蒂姆

There are two main ways to get data out of a proc.有两种主要方法可以从 proc 中获取数据。 One way is to use the OUT option on the TABLES statement.一种方法是在 TABLES 语句中使用 OUT 选项。 Another is the ODS OUTPUT statement, however that depends on your table statement.另一个是 ODS OUTPUT 语句,但这取决于您的表语句。

proc freq data=sashelp.class;
      table sex*age / out=want;
run;

The ODS approach is outlined here.此处概述了 ODS 方法。 https://blogs.sas.com/content/iml/2017/01/09/ods-output-any-statistic.html https://blogs.sas.com/content/iml/2017/01/09/ods-output-any-statistic.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM