Hi,
Using the List Report task under SAS/Enterprise Guide 4.2, I cannot find a way of instructing the task to split the column headings so that they do not take up so much horizontal space in the table.
Some of my column headings contain several words (e.g. Sales Amount (inc. Sales Tax)) and I would prefer to be able to control the width of the column by using a split character inside the label, or some other means to avoid having very wide columns resulting in the table.
This problem is exacerbated when the variable populating the column sits under a variable which is used as an across variable as then the whole problemis repeated for each valid value of the across variable.
Is anyone able to enlighten me as to how to do this within the List Report task?
I am aware that I could extract the SAS code generated by the task and fiddle about from there in a Code module, but I am hoping to achive this solely within the List report task.
Cheers,
DownUnder Dave
New Zealand.
Hi:
The default split character for a header is the slash / character. So you might try setting a label for your variable of:
label sales='Sales Amount /(inc. Sales Tax)';
The issue will then become that for procedures that do not have a split character, you will see the / in the label. So, either change the label inside the List Report task, or live with the / in other places.
When this label is distracting under an ACROSS variable, in code, you would turn the label to ' ' (quote space quote). I don't know if the List Report Wizard will allow you to do that. As you can see in example 1b, in the code below, using quote-space-quote in the SALES header UNDER an ACROSS item (as in PRODUCT,SALES )produces undesirable results.
I know you don't want to run code, but observe the difference if you do run the program below -- in the column headers based on the order of the items in the COLUMN statement. If you rearrange the items in the COLUMN statement so that sales, comes first, as in SALES,PRODUCT (list the analysis variable first) -- then you can use quote-space-quote to get rid of the entire blank row that REPORT would create.
So to insert the split character should be easy, since I assume that the List Report Task does not alter the default of / . If they have changed the split character, you would see it in the code as:
proc report data=sashelp.shoes nowd split='*'; (if they change it)
OR
proc report data=sashelp.shoes nowd split='/'; (if they just explicitly use the default)
The List Report Task is meant to generate simple reports easily -- reports that you can't generate with PROC PRINT, such as summary reports and simple ACROSS reports. But, to streamline the column headers or do more complex things in your report, I think you have to do in code.
cynthia
ods html file='c:\temp\header1.html' style=egdefault;
proc report data=sashelp.shoes nowd;
where region contains 'Europe';
title '1a) Default Label';
column region product,sales;
define region / group;
define product / across;
define sales / sum 'Total/Sales';
run;
proc report data=sashelp.shoes nowd;
where region contains 'Europe';
title '1b) Default Label with space';
column region product,sales;
define region / group;
define product / across;
define sales / sum ' ';
run;
proc report data=sashelp.shoes nowd;
where region contains 'Europe';
title '2) Rearranged Variables and Label with space';
column region sales,product;
define region / group;
define product / across 'Total Sales/Based on Product';
define sales / sum ' ';
run;
ods html close;
Hi:
The default split character for a header is the slash / character. So you might try setting a label for your variable of:
label sales='Sales Amount /(inc. Sales Tax)';
The issue will then become that for procedures that do not have a split character, you will see the / in the label. So, either change the label inside the List Report task, or live with the / in other places.
When this label is distracting under an ACROSS variable, in code, you would turn the label to ' ' (quote space quote). I don't know if the List Report Wizard will allow you to do that. As you can see in example 1b, in the code below, using quote-space-quote in the SALES header UNDER an ACROSS item (as in PRODUCT,SALES )produces undesirable results.
I know you don't want to run code, but observe the difference if you do run the program below -- in the column headers based on the order of the items in the COLUMN statement. If you rearrange the items in the COLUMN statement so that sales, comes first, as in SALES,PRODUCT (list the analysis variable first) -- then you can use quote-space-quote to get rid of the entire blank row that REPORT would create.
So to insert the split character should be easy, since I assume that the List Report Task does not alter the default of / . If they have changed the split character, you would see it in the code as:
proc report data=sashelp.shoes nowd split='*'; (if they change it)
OR
proc report data=sashelp.shoes nowd split='/'; (if they just explicitly use the default)
The List Report Task is meant to generate simple reports easily -- reports that you can't generate with PROC PRINT, such as summary reports and simple ACROSS reports. But, to streamline the column headers or do more complex things in your report, I think you have to do in code.
cynthia
ods html file='c:\temp\header1.html' style=egdefault;
proc report data=sashelp.shoes nowd;
where region contains 'Europe';
title '1a) Default Label';
column region product,sales;
define region / group;
define product / across;
define sales / sum 'Total/Sales';
run;
proc report data=sashelp.shoes nowd;
where region contains 'Europe';
title '1b) Default Label with space';
column region product,sales;
define region / group;
define product / across;
define sales / sum ' ';
run;
proc report data=sashelp.shoes nowd;
where region contains 'Europe';
title '2) Rearranged Variables and Label with space';
column region sales,product;
define region / group;
define product / across 'Total Sales/Based on Product';
define sales / sum ' ';
run;
ods html close;
Hi Cynthia,
Thanks for a rapid and comprehensive answer. I appreciate what you say that the List Report Task is for simpler designs of reports.
The slash character suggestion works just fine in the List Report Task.
Your suggestion of using a <quote><space><space> character string as the Label value in order to get rid of the repeated label under an across variable does not work for me. I tried both single and double quotes but had no joy when using the List Report Task. The result in the table was exactly the characters I had entered into the Custom Label control of the Column Headings dialog box. However, a bit of searching through the SAS Conference/Forum proceedings gave me this paper:
http://www2.sas.com/proceedings/forum2007/064-2007.pdf
(064-2007 "Using Invisible Characters in SAS® Programming. Hidden Dragons, Episode II" by Shi-Tao Yeh, GlaxoSmithKline, King of Prussia, PA)
This paper suggested using the Alt-255 non-printing character in place of the value for the variable label and this worked very well for me in the List Report Task.
So I have gained two things from this post. Thank you Cynthia and Shi-Tao.
All done.
Dave.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.