【问题标题】:How to move decimal point to the left in proc freq/proc tabulate percentage output?如何在proc freq / proc制表百分比输出中将小数点向左移动?
【发布时间】:2018-11-18 01:14:27
【问题描述】:

我正在使用 proc tabulate 创建一个表,但我需要我的百分比输出为 0.81 而不是 om 81 %。我尝试过使用图片格式,但不太正确。目前我的输出只显示 0 而不是 0,81。

我在下面发布了我的代码:

Data have; 
input gender q1 year;
lines;
0  0  2014
0  1  2014
0  1  2014
0  1  2014
0  0  2014
1  1  2014
1  1  2014
1  1  2014
1  0  2014
1  1  2014
1  1  2014
;
run;

Proc format;
  value gender  0="boy"
                1= "girl";
  value q1f     0= "No"
                1="Yes";
run;

Proc format;
   picture test (round) low-high=0.000.009(mult=0.1);
run;

Proc tabulate data=have;
class gender q1 year;
table gender*(pctn<q1>*F=test.), year*q1;
format gender gender. q1 q1f.;
run;

【问题讨论】:

  • 是否有某些原因需要创建格式而不是仅使用 *F=8.2

标签: sas decimal-point


【解决方案1】:

使用图片格式,您不需要 MULT 部分。不知道为什么你有第一个时期和 0。

proc format;                           
picture mypct (round) low-high='009.99%';   
run; 

来源:https://support.sas.com/kb/38/001.html

PROC TABULATE 提供了比 PROC FREQ 更多的输出控制,并且是一个类似的过程。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多