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.
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;
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;
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.
Ready to level-up your skills? Choose your own adventure.