The SAS Output Delivery System and reporting techniques

Increase cellpadding *horizontally* in Proc Report

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 96
Accepted Solution

Increase cellpadding *horizontally* in Proc Report

Hi everyone,

 

I'd like to know if there is a way to keep some horizontal padding between my columns, but not between my rows in Proc Report.  Currently, I am doing something like this:

 

proc report data=temp   ls=120 ps=40 nowd style(report)=[frame=hsides rules=groups cellpadding=1 cellspacing=0 ];

 

,but I would like to increase the distance between the columns, without reducing the number of rows on my page.  The only option I've found is to manually set the width of the columns.

 

Thanks!

 


Accepted Solutions
Solution
‎12-17-2015 03:41 AM
Grand Advisor
Posts: 9,335

Re: Increase cellpadding *horizontally* in Proc Report

style={cellspacing=20}

could work ?

also try the following style on your variables.

style={pretext='   '  posttext='    '}

View solution in original post


All Replies
Grand Advisor
Posts: 9,748

Re: Increase cellpadding *horizontally* in Proc Report

Which destination, since not all options work for all destination, and what style are you currently using?

Do you need additional space before, after or both of displayed values?

 

Frequent Contributor
Posts: 96

Re: Increase cellpadding *horizontally* in Proc Report

[ Edited ]

Hi Ballardw,
Thanks for replying! I'm currently outputting to ODS RTF, then I have a VBScript that opens the RTF and saves to PDF.

I'd answer "both" to your question. Basically, my problem is that I have wide headers (say 6 characters) but narrow data (say 1 digit). With a cellpadding of 1, the headers are hard to distinguish as the gap between each word is very small.

Grand Advisor
Posts: 16,403

Re: Increase cellpadding *horizontally* in Proc Report

Why not straight to ODS PDF?
Frequent Contributor
Posts: 96

Re: Increase cellpadding *horizontally* in Proc Report

I dunno really.  I was pushed that way here :

https://communities.sas.com/t5/ODS-and-Base-Reporting/Running-commands-in-windows-space-in-directory...

 

I'm using a few commands that (may?) only work in ODS RTF, such as "pretext='\ql\li360" to indent some columns. Like here :

http://support.sas.com/resources/papers/proceedings09/027-2009.pdf

 

SAS Super FREQ
Posts: 8,646

Re: Increase cellpadding *horizontally* in Proc Report

Hi,

  There are other ways to perform indents other than RTF control strings. For example, consider the code below, which works in both RTF and PDF. This is an older example that was posted in the forum in response to an earlier question. I can't take a screen shot now, but this should still work for you. No VB required to make a PDF that has indents.

cynthia

 

ods listing close;

ods pdf file='c:\temp\indent.pdf';

ods rtf file='c:\temp\indent.rtf';

  proc report data=sashelp.class nowd;

    where sex = 'F';

    column name;

    define name / display;

    compute name;

       if name in ( 'Barbara', 'Carol', 'Janet', 'Joyce') then

          call define(_col_,'style','style={leftmargin=.25in}');

    endcomp;

  run;

ods _all_ close;

Frequent Contributor
Posts: 96

Re: Increase cellpadding *horizontally* in Proc Report

Hi Cynthia,
Thanks for replying! That is indeed very interesting and useful. I have to admit the main reason that I'm using RTF to PDF is t hat most white papers I've read in the last two weeks always use ods RTF (including that old one of yours from 2008 I asked about last week).

VBScript might not be required, but my script already is up and running, so if there is any advantage to sticking to RTF I might as well Smiley Surprised)

Back to the original question, what would be a good practice to make sure I have enough padding between my columns without manually editing the column widths?

My current solution is to add 1 character wide column, like the _empty column in this paper.:

https://support.sas.com/resources/papers/proceedings11/246-2011.pdf


data class;
set sashelp.class(obs=3);
_empty='';
run;


SAS Super FREQ
Posts: 8,646

Re: Increase cellpadding *horizontally* in Proc Report

If you like the look of the report on page 8 of Allison's paper, then the only way to get it is with the use of a "helper" variable like _empty. If you want to stick with your VB script that's up to you. Just note that many of the papers you are referencing are using the techniques they show because they were written for 9.1.3 (my original 2008 paper) and 9.2 or 9.3 (my later PROC REPORT papers).
cynthia
Frequent Contributor
Posts: 96

Re: Increase cellpadding *horizontally* in Proc Report

[ Edited ]

Hi Cynthia,

Thanks for the heads up.  I'll give direct outputting to PDF a better look. Do you have links to papers that show best practices for Proc Report using  ODF PDF handy?

 

Also, I'm afraid I'm stuck with 9.3

 

thanks

 

Frequent Contributor
Posts: 96

Re: Increase cellpadding *horizontally* in Proc Report

[ Edited ]

Cool, thanks!

What about changing the borderbottomcolor and justificated in a spanned header cell, like 

("^S={just=c borderbottomcolor=&lightgrey.} Metrics^{super 1}" height weight )

 

In the code below?

 

thanks,

Simon

--------------

 

ods rtf file="c:\temp\report.rtf" style=styles.custom;
OPTIONS NODATE NONUMBER;
ods escapechar = '^';

proc sort data= sashelp.class out=temp;; by sex height weight;
  run;
data temp; set temp; by sex; if first.sex then sex2= sex; else sex2=""; obs=_n_; weight_cat= floor(weight/10)*10; _empty=' '; run;
proc report data=temp ls=120 ps=40 nowd split="*" style(report)=[] style(header)= [just=r] style(column)= [just=r];
column obs sex2 name ("^S={just=c borderbottomcolor=&lightgrey.} Metrics^{super 1}" height weight ) row_color ;
define obs /display noprint; define sex2/display "Sex" style(header)=[just=l borderbottomcolor=&lightgrey.] style(column)=[just=l]; define name /display "Name" style(header)=[just=l borderbottomcolor=&lightgrey.] style(column)=[just=l]; define height/display "Height" format =5.1 style(header)=[just=r borderbottomcolor=&lightgrey.] style(column)=[just=r]; define weight /display "Weight^{super 2}" format =5.0 style(header)=[just=r borderbottomcolor=&lightgrey.] style(column)=[just=r ] format=16.; define row_color /computed noprint; compute row_color; if mod(obs,2)=1 then call define (_row_,"style","style=[background=&verylightgrey.]"); endcomp; run; quit; ods rtf close;  

 

Solution
‎12-17-2015 03:41 AM
Grand Advisor
Posts: 9,335

Re: Increase cellpadding *horizontally* in Proc Report

style={cellspacing=20}

could work ?

also try the following style on your variables.

style={pretext='   '  posttext='    '}
Frequent Contributor
Posts: 96

Re: Increase cellpadding *horizontally* in Proc Report

Hi Xia,
Pretext looks good, thanks!


I dont like the cellspacing because it adds white space around cells that have a coloroued background.
Post a Question
Discussion Stats
  • 11 replies
  • 1124 views
  • 0 likes
  • 5 in conversation