Help using Base SAS procedures

Proc Report: column names on the same row?

Accepted Solution Solved
Reply
Regular Contributor
Posts: 199
Accepted Solution

Proc Report: column names on the same row?

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;


Accepted Solutions
Solution
‎03-04-2014 11:34 PM
SAS Super FREQ
Posts: 8,868

Re: Proc Report: column names on the same row?

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;

View solution in original post


All Replies
Solution
‎03-04-2014 11:34 PM
SAS Super FREQ
Posts: 8,868

Re: Proc Report: column names on the same row?

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;

Regular Contributor
Posts: 199

Re: Proc Report: column names on the same row?

Thank you.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 218 views
  • 0 likes
  • 2 in conversation