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
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
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
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.
Thanks so much Cynthia! That explains why I couldn't find it in the documentation. I shall spread the word that we should modernize our code to use the current function-style syntax.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.