作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 SAS 中的 Proc sgplot 将每个组的数量添加到 xaxis 上的组标签中。这是我想要的数据和图表。我想在 xaxis(手写部分)上有每个条的样本。非常感激你的帮助!
Data have ;
input type sex $ n n_total percent ;
datalines;
0 F 6 29 20.7
1 F 387 496 78.2
0 M 4 15 26.6
1 M 264 305 86.5
;
Run;
proc sgplot data=have ;
vbarparm category= type response=percent /group=sex groupdisplay=cluster datalabel;
run;
我要创建的图形:
最佳答案
您可以计算显示百分比值和文本 n=
例子:
Data have ;
input type sex $ n n_total percent ;
datalines;
0 F 6 29 20.7
1 F 387 496 78.2
0 M 4 15 26.6
1 M 264 305 86.5
;
Run;
data plot;
set have;
barlabel = cats(percent) || ' %N/(n=' || cats(n_total, ')');
run;
proc sgplot data=plot;
vbarparm
category=type
response=percent
/ group=sex
groupdisplay=cluster
datalabel=barlabel datalabelfitpolicy=splitalways splitchar='/'
;
label percent = 'Percent N having some attribute';
run;
关于sas - 使用 Proc sgplot 的条形图中每个条形的不同标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66130414/
我正在尝试使用 SAS 中的 Proc sgplot 将每个组的数量添加到 xaxis 上的组标签中。这是我想要的数据和图表。我想在 xaxis(手写部分)上有每个条的样本。非常感激你的帮助! Dat
以下代码来自 SAS 的网站。 我使用它来最终创建箱线图,但是我有两个具有相同“分组”变量的数据集(有 5 个类别/级别/选项,例如 A、B、C、D 和 E)。 目前,该代码自动将颜色编码应用于两个图
有人有关于从 PROC SGPLOT(以及 SGSCATTER 等类似函数)获取干净 PDF 输出的提示吗? 当我使用 ODS 创建图形并将其写入 PDF 时,结果在 sas EG 报告窗口中看起来不
我是一名优秀的程序员,十分优秀!