11-21-2012 11:53 AM
I'm trying to apply compress function to a string with closed paranthesis inside.
basically I would remove each occurrence of closed paranthesis.
Which is the correct syntax?
I have done a lot of tries without success:
%let varstring=MY STRING WITH ) CLOSED PARANTHESIS;
%let result =%sysfunc(compress(&varstring, ' )');
%let result =%sysfunc(compress(&typecodecomp, '(' )); -- it works, only for open parenthesis
%let result =%sysfunc(compress(&typecodecomp, %str(%));
Could some one help me?
11-21-2012 12:08 PM
You're heading in the right direction. Try:
%let result = %sysfunc(compress (%superq(typecodecomp), %str(%)) ));
You will still have two consecutive blanks after removing the parenthesis. Good luck.
Should I be using VARSTRING instead of TYPECODECOMP? Either way, the approach should work.
11-22-2012 05:01 AM
Many thanks Astounding, it works.
Anyway, who have developed Sas has a very big fantasy...SUPERQ is a very clear name for a function...very usefull