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

Please see my code below. In the output ^{nbspace 3} does not work.

ods ESCAPECHAR="^";

data x;

x="^S={fontweight=bold}Age (years) ^S={fontweight=light}^{newline} ^{nbspace 3}n ^{newline}^{nbspace 3}Mean ± SD ^{newline}^{nbspace 3}Median (Range)";

run;

ods rtf file='XXX\try.rtf';

proc report data=x;

run;

ods rtf close;

 

I want to get below output:

Capture.JPG

 

but the rtf output is blow:

Capture_2.JPG

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

By default Proc Report will left justify text fields, removing spaces as needed.

You would need to define a style override for the variable to use Style =[ASIS=On] in a define statement.

Something like:

proc report data=work.x;
define x / style=[Asis=on];

run;

You are likely to get some interaction between the actual column width and your newlines making it appear as if there are extra blank lines if your column is not wide enough depending on Ods destination and I'm not sure about a consistent fix for that.

 

 

View solution in original post

2 REPLIES 2
ballardw
Super User

By default Proc Report will left justify text fields, removing spaces as needed.

You would need to define a style override for the variable to use Style =[ASIS=On] in a define statement.

Something like:

proc report data=work.x;
define x / style=[Asis=on];

run;

You are likely to get some interaction between the actual column width and your newlines making it appear as if there are extra blank lines if your column is not wide enough depending on Ods destination and I'm not sure about a consistent fix for that.

 

 

Niugg2010
Obsidian | Level 7

If add define x / style=[Asis=on]; the space issue can be fixed. Thanks

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 2332 views
  • 0 likes
  • 2 in conversation