BookmarkSubscribeRSS Feed
statistician13
Quartz | Level 8

I am trying to create a very basic report using inline formatting (I'm aware and know how to use proc report but I want to explore inline formatting since the end result will need to be more like a mail merge document with SAS than an actual report):

Here is my code:

options pagesize=max;
OPTIONS LINESIZE = 256;
options orientation=landscape;
ods pdf file="d:\old\test.pdf" startpage=never style=minimal ;
ods escapechar='^';

data testthis2;
file print;
set allfreq;
length x $2000;
call symput('n', table);
x=catt('^{style[font_face=Calibri font_weight=bold just=left font_size=12pt color=purple]', strip(column_value2), '}');
put x;
run;
  
ods pdf close;

When I run this code, the the document is produced, but if column_value2 exceeds a certain number of characters, including the inline formatting statements, its to "break" the output and instead of seeing my formatting, the long lins end up displaying the line format.  The shorter lines display fine with the formatting.  For example, one long line in my test dataset contains the text "The quick brown fox jumped over the lazy dogs" in the variable column_value2, but it displays as follows in the report:

^{style[font_face=Calibri font_weight=bold just=left font_size=12pt color=purple]The quick brown fox jumped over the lazy dogs}


Rather than the puple-formatted words "The quick brown fox jumped over the lazy dogs."

I'm fairly certain this may have something to do with the linesize or pagesize as after messing with these options, I was able to get more values form the variable to display correctly.  Any ideas who I can solve this or what is causing the problem?

Thanks.

 

1 REPLY 1
PGStats
Opal | Level 21

I ran this:

 

options pagesize=max;
OPTIONS LINESIZE = 256;
options orientation=landscape;
ods pdf file="&sasforum\reports\test pdf.pdf" startpage=never style=minimal ;
ods escapechar='^';

data _null_;
file print;
length x $2000;
column_value2 = "The quick brown fox jumped over the lazy dogs";
x=catt('^{style[font_face=Calibri font_weight=bold just=left font_size=12pt color=purple]', strip(column_value2), '}');
put x;
run;
  
ods pdf close;

and got the intended output file. I am using SAS version 9.4

PG

sas-innovate-2024.png

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.

 

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
  • 1 reply
  • 934 views
  • 0 likes
  • 2 in conversation