BookmarkSubscribeRSS Feed
ddutton325
Fluorite | Level 6

Hi folks,

I have search high and low in the Doc and cannot find anything about using the ODS Escapecharacter in strings followed by a single character, instead of one of the escapecharacter functions inside {---}.  And yet, I know that ^n (or whatever escape character you are using) works to give a new line, just as ^{newline} would.   Are there any other single characters that can be used in such a way, and if so, where are they documented?  

Thanks,

Donna

4 REPLIES 4
Tom
Super User Tom
Super User

You can use almost any character you want.  Just tell SAS which one you want to use with the ODS ESCAPECHAR statement.

 

https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/odsug/p11xia2ltavr8ln17srq8vn4rnqc.htm

 

ddutton325
Fluorite | Level 6

no, sorry Tom, you misunderstood me.  I know how to change the default '^' to whatever I want it to be.  My question is about the 'n' which follows the escape character, which is what results in the new line.  Are there other commands besides this 'n'? Are where is it (or where are they) documented. 

Donna

Tom
Super User Tom
Super User

Not sure.  There used to be some cheat sheets for ODS, perhaps something is written there.

 

You could try running an experiment.

data test;
 length code 8 char $1 odschar $2 ;
 format code hex2. ;
 do code = rank(' ') to rank('~');
   char = byte(code);
   odschar= '^'||char;
   output;
 end;
run;
ods escapechar='^';
proc print;
run;

Looks to me like it did something strange with: hyphen, 0 to 9, P, underscore, a, h, m, n, p, w and z.

Cynthia_sas
SAS Super FREQ
Hi:
The single character ESCAPECHAR that you mention was used for a LINEFEED or RETURN in the version of ODS prior to SAS 9.2. The older version of syntax is not guaranteed to work in all the destinations.
If you look for some of the older user group papers on ODS ESCAPECHAR, including my old 2007 paper "Funny ^Stuff~ in My Code", https://support.sas.com/resources/papers/proceedings/proceedings/forum2007/099-2007.pdf you can see some of the original syntax. But even back then, I showed the newer syntax that was on the way with SAS 9.2. However, just be aware of the fact that the new "function" style of ODS ESCAPECHAR replaced that original style.
Cynthia

SAS Innovate 2025: Call for Content

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 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 203 views
  • 2 likes
  • 3 in conversation