有没有办法让 SAS 只打印频率 table 的前 10 行?

Is there a way to get SAS to only print the first 10 rows of a frequency table?

我在 Jupyter 笔记本中使用 proc freq,但我不想显示结果频率 table 中的所有行,只显示前 10 行。我尝试使用 (obs=10)但这只是使用数据中的前 10 个观察值打印频率 table,这不是我想要的。

不是直接来自 PROC FREQ。您可以分两步完成:

  1. PROC FREQ,但不打印输出;相反,使用 OUT=
  2. 将其发送到 table
  3. PROC PRINT 或 PROC REPORT table,使用 OBS= 对其进行限制。

一个例子:

proc freq data=sashelp.cars;
tables make;
run;

变成

proc freq data=sashelp.cars noprint;
tables make/out=tbl_make;
run;

proc print data=tbl_make(obs=10) noobs;
run;

一个强烈推荐的选项是将 order=freq 选项添加到 proc freq 语句,因为通常您感兴趣的是更高的频率。