SAS PROC报告如何将分析变量显示为行?
我不知道从哪里开始。我试着按每个可能的顺序列出这些列,但它们总是水平列出的。数据集是:SAS PROC报告如何将分析变量显示为行?,sas,Sas,我不知道从哪里开始。我试着按每个可能的顺序列出这些列,但它们总是水平列出的。数据集是: data job2; input year apply_count interviewed_count hired_count interviewed_mean hired_mean; datalines; 2012 349 52 12 0.149 0.23077 2013 338 69 20 0.20414 0.28986 2014 354 70 18 0.19774
data job2;
input year apply_count interviewed_count hired_count interviewed_mean hired_mean;
datalines;
2012 349 52 12 0.149 0.23077
2013 338 69 20 0.20414 0.28986
2014 354 70 18 0.19774 0.25714
;
run;
以下是仅针对一个分析变量的proc报告代码示例:
proc report data = job2;
columns apply_count year;
define year / across " ";
define apply_count / analysis "Applied" format = comma8.;
run;
理想情况下,最终报告如下所示:
2012 2013 2014
Applied 349 338 354
Interv. 52 69 70
Hired 12 20 18
Inter % 15% 20% 20%
Hired % 23% 29% 26%
我不知道这是不是最好的办法
data job2;
input year apply_count interviewed_count hired_count interviewed_mean hired_mean;
datalines;
2012 349 52 12 0.149 0.23077
2013 338 69 20 0.20414 0.28986
2014 354 70 18 0.19774 0.25714
;;;;
run;
proc transpose data=job2 out=job3;
by year;
run;
data job3;
set job3;
length y atype $8;
y = propcase(scan(_name_,1,'_'));
atype = scan(_name_,-1,'_');
if atype eq 'mean' then substr(y,8,1)='%';
run;
proc print;
run;
proc report data=job3 list;
columns atype y year, col1 dummy;
define atype / group noprint;
define y / group order=data ' ';
define year / across ' ';
define dummy / noprint;
define col1 / format=12. ' ';
compute before atype;
xatype = atype;
endcomp;
compute after atype;
line ' ';
endcomp;
compute col1;
if xatype eq 'mean' then do;
call define('_C3_','format','percent12.');
call define('_C4_','format','percent12.');
call define('_C5_','format','percent12.');
end;
endcomp;
run;
您可能希望将您的问题发布到communities.sas.com的ODS报告下,sas的一些Proc报告专家定期在那里回复。