I tried to use the style attribute TEXTINDENT in a proc report to indent some of the report lines. I used ODS ESCAPECHAR='^' and added the style attribute to the value of the character variable '^{Style [TEXTINDENT=8]' || var || '}'. It works as expected in PDF but for RTF the attribute produces 2 spaces regardless the value used. Even TEXTINDENT=0 results in 2 spaces. I've created a simple program to reproduce the issue. A colleague discovered that setting the attribute using the CALL DEFINE statement does work as expected. Is there any reason why RTF doesn't pick up the attribute when added to the value of the variable?
Hello,
Try to use the inline formatting in this form '^S={style-attribute=attribute-value} sample text', instead of '^{style [style-attribute=attribute-value] sample text}'
data txt;
length var1 var2 $100;
var1 = 'Line without indentation';
var2=var1;
output;
do i = 0 to 80 by 8;
var1 = '^S={TEXTINDENT=' || strip(put(i,2.)) ||'} Line with indent=' || strip(put(i,2.));
var2 = 'Line with indent=' || strip(put(i,2.));
output;
end;
run;
Hi:
Try specifying a unit of measure ... not just 8, but .5in or .25in -- the reason is that RTF/WORD need to translate all your units for textindent into TWIPS (twentieths of a printers point), so without any unit, I thought the default was pixels. I have always found the indent and leftmargin attributes work best with a definite unit of measure.
Cynthia
Hi Cynthia,
I tried to add mm as unit. To my surprise SAS accepted the unit (according to the SAS help n specifies the number of spaces). However the result is more or less the same. Where I used the style attribute in the value of the variable the indentation in RTF is two spaces regardless of the number of spaces defined. The indentation coming from the define statement replaces the number of spaces with a tab with the specified width. I'm on SAS 9.4M6 (LSAF 5.2) but I also noticed this behavior on PC SAS 9.4M5.
Daan
Open the RTF file in a text editor and see if you can find what RTF markup SAS is "writing". Might help figure how it works.
Hello,
Try to use the inline formatting in this form '^S={style-attribute=attribute-value} sample text', instead of '^{style [style-attribute=attribute-value] sample text}'
data txt;
length var1 var2 $100;
var1 = 'Line without indentation';
var2=var1;
output;
do i = 0 to 80 by 8;
var1 = '^S={TEXTINDENT=' || strip(put(i,2.)) ||'} Line with indent=' || strip(put(i,2.));
var2 = 'Line with indent=' || strip(put(i,2.));
output;
end;
run;
Hi:
I find the new style override syntax with ESCAPECHAR works for me in PDF, as shown below:
But the same code does NOT work for RTF, as shown below:
And while the old style of ESCAPECHAR override did work with RTF:
I don't know how long the original syntax will continue to be supported, so this is why I think you need to work with Tech Support.
Cynthia
Hi Cynthia,
Thanks for your support, I will contact support for clarification.
kr Daan
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: