Hi,
How do I put all the column names on the same row?
Currently, OU and Department are showing up on the row beneath 2013 and 2014 (i.e. the years from the ydoi variable).
Thank you.
proc report data=ou_sum nowd out=test
style(header)=[font_weight=bold background=CX90D9D7 ];
options missing='0';
column bu operating_unit ydoi, (dart_tot);
define bu / group style(column)={just=l} "OU";
define operating_unit / group style(column)={just=l} "Department";
define ydoi / across "";
define dart_tot / style(column)={just=r} "";
run;
Hi:
The code below shows 2 possible solutions. The issue with your code is that you are blanking the headers for YDOI and DART_TOT, but BU and OPERATING_UNIT headers are still on the report header row at the same level as the blanked out headers -- they do not "move up" automatically. Review the output from #1 and #2 and compare it to the #3 output. Since you did not provide data, I made some fake data using SASHELP.PRDSALE.
Cynthia
data ou_sum(keep=ydoi bu operating_unit dart_tot);
set sashelp.prdsale;
ydoi = year;
bu = region;
operating_unit = prodtype;
dart_tot = actual;
run;
options missing='0';
ods listing close;
ods html file='c:\temp\proc_report_column.html';
proc report data=ou_sum nowd
style(header)=[font_weight=bold background=CX90D9D7 ];
title '1) Use Headers in Column Statement';
column ('OU' bu) ('Department' operating_unit) ydoi,dart_tot;
define bu / group style(column)={just=l} " ";
define operating_unit / group style(column)={just=l} " ";
define ydoi / across " ";
define dart_tot / sum style(column)={just=r} " ";
run;
proc report data=ou_sum nowd
style(header)=[font_weight=bold background=CX90D9D7 ];
title '2) put dart_tot before ydoi in the COLUMN statement';
column bu operating_unit dart_tot,ydoi;
define bu / group style(column)={just=l} "OU";
define operating_unit / group style(column)={just=l} "Department";
define ydoi / across " ";
define dart_tot / sum style(column)={just=r} " ";
run;
proc report data=ou_sum nowd
style(header)=[font_weight=bold background=CX90D9D7 ];
title '3) wrong syntax for blanking header';
title2 'Proc report will only suppress an entirely empty row';
column bu operating_unit ydoi,dart_tot;
define bu / group style(column)={just=l} "OU";
define operating_unit / group style(column)={just=l} "Department";
define ydoi / across "";
define dart_tot / sum style(column)={just=r} "";
run;
ods html close;
title;
Hi:
The code below shows 2 possible solutions. The issue with your code is that you are blanking the headers for YDOI and DART_TOT, but BU and OPERATING_UNIT headers are still on the report header row at the same level as the blanked out headers -- they do not "move up" automatically. Review the output from #1 and #2 and compare it to the #3 output. Since you did not provide data, I made some fake data using SASHELP.PRDSALE.
Cynthia
data ou_sum(keep=ydoi bu operating_unit dart_tot);
set sashelp.prdsale;
ydoi = year;
bu = region;
operating_unit = prodtype;
dart_tot = actual;
run;
options missing='0';
ods listing close;
ods html file='c:\temp\proc_report_column.html';
proc report data=ou_sum nowd
style(header)=[font_weight=bold background=CX90D9D7 ];
title '1) Use Headers in Column Statement';
column ('OU' bu) ('Department' operating_unit) ydoi,dart_tot;
define bu / group style(column)={just=l} " ";
define operating_unit / group style(column)={just=l} " ";
define ydoi / across " ";
define dart_tot / sum style(column)={just=r} " ";
run;
proc report data=ou_sum nowd
style(header)=[font_weight=bold background=CX90D9D7 ];
title '2) put dart_tot before ydoi in the COLUMN statement';
column bu operating_unit dart_tot,ydoi;
define bu / group style(column)={just=l} "OU";
define operating_unit / group style(column)={just=l} "Department";
define ydoi / across " ";
define dart_tot / sum style(column)={just=r} " ";
run;
proc report data=ou_sum nowd
style(header)=[font_weight=bold background=CX90D9D7 ];
title '3) wrong syntax for blanking header';
title2 'Proc report will only suppress an entirely empty row';
column bu operating_unit ydoi,dart_tot;
define bu / group style(column)={just=l} "OU";
define operating_unit / group style(column)={just=l} "Department";
define ydoi / across "";
define dart_tot / sum style(column)={just=r} "";
run;
ods html close;
title;
Thank you.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.