It will not solve my problem beacuse if i have yyy"y www qqq and
I will use compress(translate(var,' ' ,'"'));
The result will be this:yyyywwwqqq
And this is not what im looking for.....
use input them to indicate the line number
data temp;
input y 1-5 m ...;
then use compress to compress the variable y
them combine them in the way you like
The following code does what you asked for.
data _null_;
have='yyy y www qqq ';
have=tranwrd(have,'y y','yy');
put have=;
want=scan(have,1);
put want=;
run;
More general solutions would be possible - especially with RegEx - but you would have to tell us a bit more in detail what the problem is about you want to solve.