I have a dataset that has ^ in the data, 1x10^3.
My escapechar is '^'.
Is there a way to mask the '^' in the data?
I know I can reset the escape character to something else, but would like to know if there is a function of some sort to make it read in the entire value, ignoring the escape character.
Thank you
Hi, the easiest thing to do is to change your escape character to something else. Change it to something like
ods escapechar='~';
or some other character like the #.
Reading the data should be OK. Take a look at this quick test:
It's when you go to use ODS to display the data that ODS ESCAPECHAR can cause you issues... as shown in this PROC PRINT output:
The data is being read correctly. Why can't you change the ESCAPECHAR before your report step?
Cynthia
So your data is in an external file you are trying to read into SAS or is it already in a SAS dataset you have read from an external file? The usual approach is to replace unprintable characters like escape with blanks. This can be done with the TRANSLATE function as you are reading your data in or during post-processing.
Hi, the easiest thing to do is to change your escape character to something else. Change it to something like
ods escapechar='~';
or some other character like the #.
Reading the data should be OK. Take a look at this quick test:
It's when you go to use ODS to display the data that ODS ESCAPECHAR can cause you issues... as shown in this PROC PRINT output:
The data is being read correctly. Why can't you change the ESCAPECHAR before your report step?
Cynthia
That is what I ended up doing.
Thank you.
To answer the second part of your post :
the footer has "page x of y" in it, and that was called from a driver file.
Changing the escapechar just before the report made the paging not present correctly.
I went back to the common driver file and changed the escapechar there. Now I will have to check other code that used the "^" escapechar to add superscripts to some headings and change it there as well.
Why are you using ^ as the escapechar for ODS if you know the text you want to display includes it?
Use a different escape character for ODS.
In part, because this data set had not been used before, so when the initial code was written, none of the data sets had '^' in them, which was what being used as the escapechar.
After producing something like 40 outputs, they requested similar tables on a data set with data that read 1x10^3 in one field.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.