我能在PROC REPORT中创建自定义列/子列吗?

huangapple go评论48阅读模式
英文:

Can I create custom columns/subcolumns in PROC REPORT?

问题

我的数据看起来像这样:

我能在PROC REPORT中创建自定义列/子列吗?

我们看到的是标签,与女性相关的列名称会以“_w”作为后缀(例如 Prevalence_w 等)。

我被告知需要将这个数据集进行数据透视,以性别作为数据透视变量。理想情况下,输出应该类似于这样:

  男性                                                  女性
    Prevalence Sample size prevalence CI upper CI lower  Prevalence_w Sample size_w prevalence_w CI upper_w CI lower_w 
    值       值          值        值      值          值        值             值        值          值

我知道我可能可以在 PROC REPORT 中将性别作为 ACROSS 变量来使用,但这将需要我改变数据的形状。此外,为了保持与先前设计的脚本的兼容性,实际上需要数据处于这种形状。

那么,是否有办法在 PROC REPORT 中手动指定标题和子标题,以便将“Sample size”、“prevalence”、“CI upper limit” 和“CI lower limit”列显示在“男性”下,而将“prevalence_w”、“CI upper limit_w”、“CI lower_limit_w” 和“Sample size_W”列显示在“女性”下呢?

英文:

My data looks something like this:

我能在PROC REPORT中创建自定义列/子列吗?

What we are seeing is the labels, so column namnes related to women would have a _w as a suffix (Prevalence_w and so forth).

I've been told that this data set needs to be pivoted, with sex as a pivoting variable. Ideally then the output should look something like this:

  Men                                                  Women
    Prevalence Sample size prevalence CI upper CI lower  Prevalence_w Sample size_w prevalence_w CI upper_w CI lower_w 
    Values     Values      Values     Values Values       Values  Values              

I know I could probably use sex as an ACROSS-variable in PROC REPORT, but that would require me to alter the shape of the data. In addition, the data actually "needs" to be in this shape in order to preserve compatibility with previously designed scripts.

So is there some way to manually specify headers and subheaders in PROC REPORT, so that the columns Sample size, prevalence, CI upper limit and CI lower limit is displayed under MEN, while prevalence_w, CI upper limit_w, CI lower_limit w and Sample size_W is displayed under WOMEN?

答案1

得分: 1

使用Across。您需要重新整理数据,或者如果确实需要重新整理,请在运行报告之前在一个名为WORK的表中进行。

英文:

Use Across. You need to reshape the data, or if you do need to reshape do it in a WORK table just prior to running REPORT.

huangapple
  • 本文由 发表于 2023年6月19日 20:56:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/76506863.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定