Insight Statistical Consulting Ltd
John Kirkpatrick MSc BSc (Hons) CStat CSci

What is the ODS ESCAPECHAR for?

I've heard lots of people talk about the ODS ESCAPECHAR, but I don't know what it does. Or, when I try to use the ESCAPECHAR, it doesn't behave as I expect. Can you help?

Personally, I find the ODS ESCAPECHAR statement one of the most useful facilities in the ODS. Unfortunately, SAS Instutute scored a couple of spectacular own goals with the ODS: first of all, they omitted it from the index of the online documentation supplied with SAS 9 (although there are several good discussions of it at support.sas.com.) Then, in most of the examples that they do supply at the SAS support site, the use a backslash as the escape character. This is a supremely inappropriate choice that only adds to the confusion. There are two reasons for this: the backslash is the character that defines an RTF control word and secondly, it's the path delimiter on Windows operating systems. Either one of these can be enough to cause trouble, but put the two of them together...

Anyway back to the question. Put simply, the ODS ESCAPECHAR is used to alert the ODS to the fact that what follows is some sort of formatting instruction, rather than text to be rendered in one or more output destinations. So, for example, you can tell SAS "This next bit of text is a superscript", or "indent this paragraph 1cm" or "omit this next bit from all destinations apart from the RTF destination.

You can read more about the ODS ESCAPECHAR statement in Using the ODS ESCAPECHAR in my tutorials section.