我想在proc报告中插入空白列和行。这是为了将复制粘贴目的转换为excel,所以希望可以创建实际的空白列和行而不仅仅是间距,但我也想学习如何控制间距。
(这与前一个问题here有关,一旦我弄明白,将用解决方案进行修订)
上一步是使用proc摘要创建一个表,其中只包含我想在表中显示的摘要统计信息,以克服使用proc表格来计算多个类变量缺失值的百分比的问题。
以下是摘要数据集:
data job;
input dem $ year apply_count interviewed_mean hired_mean;
datalines;
Male 2012 288 0.15972 0.21739
Female 2012 61 0.09836 0.33333
Male 2013 279 0.19355 0.2963
Female 2013 59 0.25424 0.26667
Male 2014 293 0.18089 0.28302
Female 2014 61 0.27869 0.17647
Degree 2012 108 0.28704 0.19355
NoDeg 2012 241 0.08714 0.28571
Degree 2013 108 0.36111 0.28205
NoDeg 2013 230 0.13043 0.3
Degree 2014 124 0.23387 0.2069
NoDeg 2014 230 0.17826 0.29268
run;
以下是我用于报告的代码:
proc report data = job;
columns dem (("Applied" apply_count) ("Interviewed" interviewed_mean) ("Hired" hired_mean)), (year);
define dem / group " ";
define apply_count / analysis "" format = comma8.;
define interviewed_mean / analysis "" format = percent8.;
define hired_mean / analysis "" format = percent8.;
define year / across "";
run;
它很完美,除了我想在每一组年份之后写一个空白专栏,所以最终结果将是:
Applied Interviewed Hired
12 13 14 12 13 14 12 13 14
Degree 108 108 124 29% 36% 23% 19% 28% 21%
NoDeg 241 230 230 9% 13% 18% 29% 30% 29%
Female 61 59 61 10% 25% 28% 33% 27% 18%
Male 288 279 293 16% 19% 18% 22% 30% 28%
答案 0 :(得分:1)
这就是我想出的。我不知道它是否会正确剪切和粘贴到Excel。
data job;
input dem $ year apply_count interviewed_mean hired_mean;
select(first(dem));
when('M','F') gr=1;
otherwise gr=2;
end;
datalines;
Male 2012 288 0.15972 0.21739
Female 2012 61 0.09836 0.33333
Male 2013 279 0.19355 0.2963
Female 2013 59 0.25424 0.26667
Male 2014 293 0.18089 0.28302
Female 2014 61 0.27869 0.17647
Degree 2012 108 0.28704 0.19355
NoDeg 2012 241 0.08714 0.28571
Degree 2013 108 0.36111 0.28205
NoDeg 2013 230 0.13043 0.3
Degree 2014 124 0.23387 0.2069
NoDeg 2014 230 0.17826 0.29268
run;
options missing=' ';
proc report data = job list;
columns gr dem (("Applied" apply_count),year gap ("Interviewed" interviewed_mean),year gap ("Hired" hired_mean),year);
define gr / group ' ' noprint;
define dem / group " ";
define apply_count / analysis "" format = comma8.;
define interviewed_mean / analysis "" format = percent8.;
define hired_mean / analysis "" format = percent8.;
define year / across "";
define gap / ' ' style={cellwidth=.25in};
compute after gr;
line ' ';
endcomp;
run;