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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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