BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I have a SAS dataset that has a variable that contains carriage returns, line feeds, and form feeds. I want to remove these without affecting any other data. I tried the COMPRESS function with the "s" modifier but I also removed blanks.....which is not good. Any ideas on how to remove just the three types of characters I mentioned? Thanks in advance.
4 REPLIES 4
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Suggest you share the exact SAS code used with COMPRESS - I would expect you might check TRANSLATE as well. Post the code and the related SAS log output info to your post with a pasted reply - consider adding some PUTLOG command logic with a hex-format output display to confirm the BEFORE / AFTER (new variable assignment) -- should help with your self-diagnosis desk checking.

Scott Barry
SBBWorks, Inc.
sfleming
Calcite | Level 5
I think you might need the 'c' modifier instead of the 's' modifier. See http://www2.sas.com/proceedings/sugi31/028-31.pdf for more on using the compress function.
deleted_user
Not applicable
Thanks to both of you. I'm deciding between both of these options. I just need to determine if I want remove the characters or replace them with something else....like a space for ease of readability.
agdesilva
Calcite | Level 5
I would also suggest rank() and byte() functions.
@agdesilva

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 4 replies
  • 3197 views
  • 0 likes
  • 4 in conversation