compress function syntax

Accepted Solution Solved
Reply
New Contributor
Posts: 3
Accepted Solution

compress function syntax

Hello all.  In a new assignment, I am trying to decode logic in some legacy SAS programs, and have come across this line numerous times:

VAR2 = compress(VAR1,'.');

The variable names have been changed to protect the innocent.  My question is the period "." used as a modifier.  I can't seem to find this in the reference for the compress function.  How is it being used here, and what is the translation of using a period?

Thanks!


Accepted Solutions
Solution
‎07-29-2013 03:40 PM
Super User
Posts: 19,780

Re: compress function syntax

The second parameter to the compress function is not a modifier, its characters, Check the documentation again.

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

chars

specifies a character constant, variable, or expression that initializes a list of characters.

By default, the characters in this list are removed from the source argument. If you specify the K modifier in the third argument, then only the characters in this list are kept in the result.

View solution in original post


All Replies
Solution
‎07-29-2013 03:40 PM
Super User
Posts: 19,780

Re: compress function syntax

The second parameter to the compress function is not a modifier, its characters, Check the documentation again.

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

chars

specifies a character constant, variable, or expression that initializes a list of characters.

By default, the characters in this list are removed from the source argument. If you specify the K modifier in the third argument, then only the characters in this list are kept in the result.

New Contributor
Posts: 3

Re: compress function syntax

Gotcha.  Now it makes sense.  Thanks!

🔒 This topic is solved and locked.

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

Discussion stats
  • 2 replies
  • 211 views
  • 0 likes
  • 2 in conversation