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

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

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ
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

7 REPLIES 7
ballardw
Super User

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?

DonMacnaughton
Obsidian | Level 7

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.

ballardw
Super User

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.

DonMacnaughton
Obsidian | Level 7

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.

 

 

Cynthia_sas
SAS Super FREQ
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

DonMacnaughton
Obsidian | Level 7

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

Ksharp
Super User
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;

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
  • 7 replies
  • 4496 views
  • 1 like
  • 4 in conversation