【问题标题】:Using proc format for columns in SAS output对 SAS 输出中的列使用 proc 格式
【发布时间】:2021-03-30 20:28:54
【问题描述】:

我有以下数据

DATA HAVE;
input year dz $8. area;
cards;
2000 stroke 08
2000 stroke 06
2000 stroke 06
;
run;

使用 proc freq 后

proc freq data=have;
table area*dz/ list nocum ;
run;

我得到以下输出

我想分别用“

我有以下 proc 格式代码

 proc format;
picture count (round)
0-4 = ' <5' (NOEDIT);
picture pcnt (round)
0 = ' - '
other = '009.9%';

但我不明白如何在数据步骤中使用它来获得所需的结果。请指导。

谢谢!

【问题讨论】:

    标签: sas format output


    【解决方案1】:

    您可以将proc freq 的结果保存为数据集,然后按您的意愿报告。

    proc freq data=have noprint;
      table area*dz/ list nocum out = want;
    run;
    
    proc print;
      format COUNT count. PERCENT pcnt.;
    run;
    

    如果您希望您的proc freq 输出结果如您所愿,而不是使用额外的报告或打印程序,您需要编写更多代码。答案是关于 ods 风格的,有一篇非常好的文章:Using Styles and Templates to Customize SAS® ODS Output

    【讨论】:

      猜你喜欢
      • 2021-06-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-21
      • 1970-01-01
      • 2018-10-18
      • 1970-01-01
      相关资源
      最近更新 更多