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@gmail.com

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore 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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 5143 views
  • 0 likes
  • 4 in conversation