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
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?
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.
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.
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.
Thank you. That, together with ballardw's suggested change to the DEFINE TEXT solves my problem.
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;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.