BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
morglum
Quartz | Level 8

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!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
style={cellspacing=20}

could work ?

also try the following style on your variables.

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

View solution in original post

11 REPLIES 11
ballardw
Super User

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?

 

morglum
Quartz | Level 8

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.

Reeza
Super User
Why not straight to ODS PDF?
morglum
Quartz | Level 8

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

 

Cynthia_sas
SAS Super FREQ

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;

morglum
Quartz | Level 8
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 🐵

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;


Cynthia_sas
SAS Super FREQ
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
morglum
Quartz | Level 8

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

 

morglum
Quartz | Level 8

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;  

 

Ksharp
Super User
style={cellspacing=20}

could work ?

also try the following style on your variables.

style={pretext='   '  posttext='    '}
morglum
Quartz | Level 8
Hi Xia,
Pretext looks good, thanks!


I dont like the cellspacing because it adds white space around cells that have a coloroued background.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 11 replies
  • 10958 views
  • 1 like
  • 5 in conversation