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

Can you indent items where a line feed is also being used in ODS RTF?

 

example: Item1||"~n~S={leftmargin = 0.2in}"||item2||"~n~S={leftmargin = 0.2in}"||item3

 

The end result would be this:

Item1

       Item2 blah blah

       item2 wraps here

               Item 3 blah blah

               item 3 wraps here, etc.

1 ACCEPTED SOLUTION

Accepted Solutions
Kathryn_SAS
SAS Employee

In my tests, the INDENT= style attribute only applies to the first value. You can try a hanging indent, but the subsequent lines will have the same indention. Another alternative is to add spaces and then use the ASIS=ON style attribute. I have included an example below.

 

data test;
item1='Item 1';
item2='Item 2';
item3='Item 3';
text= '~S={indent=.25in}'||Item1||"~n"||"~S={indent=.5in}"||item2||"~n~S={indent=.75in}"||item3;
text1=Item1||"~n"||item2||"~n"||item3;
text2=Item1||"~n    "||item2||"~n          "||item3;
run;

ods listing close;
ods escapechar='~';
ods rtf file='test.rtf';

proc report data=test;
column text text1 text2;
define text / display style(column)=[cellwidth=2in];
define text1 / display style(column)={cellwidth=2in 
                               protectspecialchars=off 
                               pretext='\pnhang\fi-220\li220 '};
define text2 / display style(column)=[cellwidth=2in asis=on];
run;

ods rtf close;
ods listing;

View solution in original post

1 REPLY 1
Kathryn_SAS
SAS Employee

In my tests, the INDENT= style attribute only applies to the first value. You can try a hanging indent, but the subsequent lines will have the same indention. Another alternative is to add spaces and then use the ASIS=ON style attribute. I have included an example below.

 

data test;
item1='Item 1';
item2='Item 2';
item3='Item 3';
text= '~S={indent=.25in}'||Item1||"~n"||"~S={indent=.5in}"||item2||"~n~S={indent=.75in}"||item3;
text1=Item1||"~n"||item2||"~n"||item3;
text2=Item1||"~n    "||item2||"~n          "||item3;
run;

ods listing close;
ods escapechar='~';
ods rtf file='test.rtf';

proc report data=test;
column text text1 text2;
define text / display style(column)=[cellwidth=2in];
define text1 / display style(column)={cellwidth=2in 
                               protectspecialchars=off 
                               pretext='\pnhang\fi-220\li220 '};
define text2 / display style(column)=[cellwidth=2in asis=on];
run;

ods rtf close;
ods listing;
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
  • 1552 views
  • 1 like
  • 2 in conversation