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

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?

1 ACCEPTED SOLUTION

Accepted Solutions
Athenkosi
Obsidian | Level 7

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;

View solution in original post

7 REPLIES 7
Cynthia_sas
SAS Super FREQ

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

DaanDNR
Obsidian | Level 7

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

Cynthia_sas
SAS Super FREQ
Hi:
If you are using a unit of measure and not getting more than 2 spaces as an indent, then you need to open a track with Tech Support because this is something that will need to be investigated in greater depth.

Cynthia
data_null__
Jade | Level 19

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.  

Athenkosi
Obsidian | Level 7

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;
Cynthia_sas
SAS Super FREQ

Hi:

  I find the new style override syntax with ESCAPECHAR works for me in PDF, as shown below:

Cynthia_sas_0-1615302532528.png

 

But the same code does NOT work for RTF, as shown below:

Cynthia_sas_1-1615302586846.png

And while the old style of ESCAPECHAR override did work with RTF:

Cynthia_sas_2-1615302896745.png

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

 

DaanDNR
Obsidian | Level 7

Hi Cynthia,

Thanks for your support, I will contact support for clarification.

kr Daan

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
  • 7 replies
  • 1995 views
  • 0 likes
  • 4 in conversation