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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1474 views
  • 0 likes
  • 2 in conversation