BookmarkSubscribeRSS Feed
1162
Calcite | Level 5
I'm using SAS to extract data from a database. Some of the fields I'm grabbing are text fields that have newline and carriage return characters embedded. I tried to use TRANWRD to remove these characters, but I may not be doing it correctly.

When I import this data into MS Excel, I see that the special characters appear as '\x0a\x0d'. SAS displays this as a pair of boxes.

What is the proper way to remove these newline and carriage return characters from a text field?
3 REPLIES 3
1162
Calcite | Level 5
Looks like I answered my own question . . .

I can refer to them as '0D'x and '0A'x in the TRANSLATE function.
Patrick
Opal | Level 21
TRANSLATE will work, COMPRESS would do the job as well.
If you're ever looking for more difficult replacements then get familiar with regular expressions (PRXCHANGE and the like).
Cheers
Patrick
Peter_C
Rhodochrosite | Level 12
should be careful with this kind of data.

why do these special values occur?

Possibly they mean something.

Check with someone who knows that data source, or the service provider

good luck

PeterC

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
  • 3 replies
  • 2288 views
  • 0 likes
  • 3 in conversation