Help using Base SAS procedures

Tabs in Compress function

Accepted Solution Solved
Reply
SAS Employee
Posts: 4
Accepted Solution

Tabs in Compress function

Does anyone know how to remove a tab from a string using the COMPRESS function, even when editor options are set to replace tabs with spaces?

Ex.  test = compress(string,"-,/     ");   --where the space is an actual tab and not spaces

I tried turning off the option to use spaces in place of a tab but it still didn't work.


Accepted Solutions
Solution
‎11-07-2013 12:24 PM
Super Contributor
Posts: 282

Re: Tabs in Compress function

Hi,

According to the documentation for SAS 9.2, using "h" or "H" as the third argument will do the trick.

SAS(R) 9.2 Language Reference: Dictionary, Fourth Edition

Regards,

Amir.

View solution in original post


All Replies
Solution
‎11-07-2013 12:24 PM
Super Contributor
Posts: 282

Re: Tabs in Compress function

Hi,

According to the documentation for SAS 9.2, using "h" or "H" as the third argument will do the trick.

SAS(R) 9.2 Language Reference: Dictionary, Fourth Edition

Regards,

Amir.

SAS Employee
Posts: 4

Re: Tabs in Compress function

Thank you Amir!!!  I should have looked a little harder.

Super User
Super User
Posts: 7,079

Re: Tabs in Compress function

If you want to compress out a specific character you can use a hexadecimal string literal.

test = compress(string,'09'X) ;


🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 4009 views
  • 0 likes
  • 3 in conversation