BookmarkSubscribeRSS Feed
JensVestergård
Calcite | Level 5

Hi
I would like to use the obj-format_text method to insert text in a PDF-document. Some of the textstrings have leading spaces (hex 20), but hven the text is inserted, the leading spaces disappears 😢

data test;

  text = '     With spaces'; output;  
  text = 'Without spaces  '; output;
run;

ods _all_ close;
ods pdf file = "e:\Test.pdf";

data _null_;
  set test;

  if _n_ = 1 then declare odsout obj();

  obj.format_text(data:        text,
                  format:      '$char25.', 
                  style_attr:  'font_size=6pt font=(courier)');
run;

ods pdf close;

What to do, if I want to keep the leading spaces in the PDF-file ?

 

This is what happens, at not what I want....

Spaces.jpg

 

?

 

Regards
Jens Vestergård

LB Forsikring

1 REPLY 1
PeterClemmensen
Tourmaline | Level 20

I think this is caused by the horizontal justification of the FORMAT_TEXT Method, which is Just : 'L' (left align) by default. 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 315 views
  • 0 likes
  • 2 in conversation