The SAS Output Delivery System and reporting techniques

Problem with Vertical Line Spacing with PROC REPORT

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 15
Accepted Solution

Problem with Vertical Line Spacing with PROC REPORT

I’m using PROC REPORT to generate text on an HTML page containing text interspersed with graphics and other SAS output. I’m doing this because it allows me to control the line width, which enhances readability. Everything works well except that I’ve been unable to discover how to control the vertical spacing within paragraphs of text. The following program demonstrates the problem. Is there a way that I can control the vertical line spacing within paragraphs?

 

I'm using the latest version of SAS University Edition.

/* Is there a way to control the vertical spacing between lines in 
   paragraphs in an HTML output file from this program? */

options noquotelenmax;
data textlines;
   length text $ 700;
   input text $ &;
datalines;
This is the FIRST paragraph in the report. The text in the paragraph is long enough so that the lines wrap. I would like to be able to set the vertical spacing between lines WITHIN each paragraph because presently the spacing is too tight.
This is the SECOND paragraph in the report. The text in the paragraph is long enough so that the lines wrap. I would like to be able to set the vertical spacing between lines WITHIN each paragraph because presently the spacing is too tight. 
;

proc report data=textlines noheader;
  col text;
  
  /* Cellwidth in the following statement controls the width of the column.
     Borderwidth controls the vertical spacing between paragraphs. */
  define text / style(column)=[cellwidth=5.5in borderwidth=10 bordercolor=white fontsize=4.5];
  run;


Thank you for your help,


Don Macnaughton


Accepted Solutions
Solution
‎09-20-2016 10:56 AM
SAS Super FREQ
Posts: 8,868

Re: Problem with Vertical Line Spacing with PROC REPORT

Posted in reply to DonMacnaughton
Hi:
Try to use an explicit "ODS sandwich" around your code instead of taking the default ODS results:

ods html file="/folders/myfolders/testpara.html";

... code using suggested changes ...
ods html close;

Then ignore whatever you see in the Results tab. You will have to go find the HTML file in the Folders list under /folders/myfolders location, then right click and select Open or Download (I forget which option it is). See whether that works better to view the PROC REPORT output.

cynthia

View solution in original post


All Replies
Super User
Posts: 11,343

Re: Problem with Vertical Line Spacing with PROC REPORT

Posted in reply to DonMacnaughton

Can you describe what you mean by "too tight"? The results I get do not look cramped just single spaced vertically. Which ODS style are you using for your output?

Occasional Contributor
Posts: 15

Re: Problem with Vertical Line Spacing with PROC REPORT

Thank you.  By "too tight" I mean that the single-spaced horizontal spacing between lines in a paragraph is too thin, and this is "too tight" for my application.  I would like to make the lines in a paragraph double-spaced, or 1.5 spaced.

 

In the example I'm not specifying a style, so I presume the style is HTMLBLUE.

Super User
Posts: 11,343

Re: Problem with Vertical Line Spacing with PROC REPORT

Posted in reply to DonMacnaughton

Through some trial and error I got this to work to double space.

 

proc report data=textlines noheader nowd;
  column text;
  define text /style=[tagattr='style=" font-size: medium; border-width: 10px; border-color: #FFFFFF; width: 5.5in;line-height:2;"'];
run;

Note that when I tried mizing the SAS style overrides with the tagattr to put "raw" html into the style string the result always had the tagattr string before and outside of the style section. So writing the entire HTML style definition between the single quotes worked.

 

Change the 2 in the line-height to desired multiple. Without a unit the difference is based on font size.

Occasional Contributor
Posts: 15

Re: Problem with Vertical Line Spacing with PROC REPORT

Thank you.  Strangely, your code doesn't solve the problem on my computer. And when I run your code on my computer, it runs without error or warning messages. But when I look at the results tab, the table width is the full width of the page, the font is quite small, and the lines are single-spaced. And each of the two paragraphs has a border.

 

If I export the output to HTML using the leftmost button under the RESULTS tab, I get the same unexpected output.

 

So I guess there's something different in my environment from yours.  Any ideas?

 

I'm running under SAS University Edition 2.3.9.4M3 (with SAS 9.04.01M3P06242015) under Oracle VirtualBox 5.0.14r105127 under up-to-date Windows 7 Professional.

 

 

Solution
‎09-20-2016 10:56 AM
SAS Super FREQ
Posts: 8,868

Re: Problem with Vertical Line Spacing with PROC REPORT

Posted in reply to DonMacnaughton
Hi:
Try to use an explicit "ODS sandwich" around your code instead of taking the default ODS results:

ods html file="/folders/myfolders/testpara.html";

... code using suggested changes ...
ods html close;

Then ignore whatever you see in the Results tab. You will have to go find the HTML file in the Folders list under /folders/myfolders location, then right click and select Open or Download (I forget which option it is). See whether that works better to view the PROC REPORT output.

cynthia

Occasional Contributor
Posts: 15

Re: Problem with Vertical Line Spacing with PROC REPORT

Posted in reply to Cynthia_sas

Thank you.  That, together with ballardw's suggested change to the DEFINE TEXT solves my problem.

Super User
Posts: 10,044

Re: Problem with Vertical Line Spacing with PROC REPORT

Posted in reply to DonMacnaughton
You can use ~n make a blank line:

data textlines;
   length text $ 700;
   input text $ &;
datalines;
This is the FIRST paragraph in the report. ~n The text in the paragraph is long enough so that the lines wrap. I would like to be able to set the vertical spacing between ~n lines WITHIN each paragraph because presently the spacing is too tight.
This is the SECOND paragraph in ~n the report. The text in the paragraph is long enough so that the lines wrap. I would like to be able to set the vertical spacing ~n between lines WITHIN each paragraph because presently the spacing is too tight. 
;


ods escapechar='~';
proc report data=textlines noheader;
  col text;
  
  /* Cellwidth in the following statement controls the width of the column.
     Borderwidth controls the vertical spacing between paragraphs. */
  define text / style(column)=[cellwidth=5.5in borderwidth=10 bordercolor=white fontsize=4.5];
  run;

☑ This topic is solved.

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

Discussion stats
  • 7 replies
  • 771 views
  • 1 like
  • 4 in conversation