Desktop productivity for business analysts and programmers

What is var1 =COMPRESS(var1, ''); doing?

Accepted Solution Solved
Reply
Contributor
Posts: 39
Accepted Solution

What is var1 =COMPRESS(var1, ''); doing?

In reviewing inherited code I come across:

var1 =COMPRESS(var1, '');

I've looked at the Compress documentation and several examples, but not sure what the two single quotes with nothing in them does?

thx


Accepted Solutions
Solution
‎09-18-2013 03:46 PM
Grand Advisor
Posts: 10,204

Re: What is var1 =COMPRESS(var1, ''); doing?

As a minimum it would remove blanks from the variable which would likely only be easily noticeable if they were leading or imbedded in the variable.

Examine what happens here:

 

data junk;

     var1 = ' some name ';

     var1 = compress(var1,'');

     put var1;

run;

View solution in original post


All Replies
Solution
‎09-18-2013 03:46 PM
Grand Advisor
Posts: 10,204

Re: What is var1 =COMPRESS(var1, ''); doing?

As a minimum it would remove blanks from the variable which would likely only be easily noticeable if they were leading or imbedded in the variable.

Examine what happens here:

 

data junk;

     var1 = ' some name ';

     var1 = compress(var1,'');

     put var1;

run;

Contributor
Posts: 39

Re: What is var1 =COMPRESS(var1, ''); doing?

perfect - that's what I thought but wanted to ensure it wasn't doing ADDITIONAL formatting...gonna remove the quotes so they don't confuse the next bloke Smiley Happy

☑ This topic is SOLVED.

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

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