Reputation:
What does compress function mean in SAS using ||? for example:
compress("test:" || 'price_data' || ":")
is it just for connecting strings using ||?
Thanks.
Upvotes: 0
Views: 2083
Reputation: 1792
The double pipe ||
operator appends strings together.
The compress()
function removes all blanks from the argument.
In this case, the compress function does nothing because the three appended string literals clearly contain no blanks. There is furthermore no reason to use appending since, again, it's all literals.
Your statement is equivalent to this "test:price_data:"
Now, if, as it seems to be the case, price_data
is supposed to be a variable, then you would need to remove the single quotes surrounding it and that statement would then make total sense
compress("test:"||price_data||":")
This produces a string that is the value of price_data
prepended with the string test
and appended with a colon and in which all blanks (i.e. any blanks that would have been introduced by price_data
) were removed by the compress
function.
Upvotes: 2