BookmarkSubscribeRSS Feed
milts
Pyrite | Level 9
hi all,

let's say i have a value '00012345

how can i remove the single quote or double quote?

if i use compress i'll get a compilation error since syntax for compress is
compress(var,"");

it is enclosed in double quotes so when you put a single quote and a double quote as your arguements, you wont be able to run the code. hope i was able to explain it correctly

are there any ways to remove quotes?

thanks in advance!
3 REPLIES 3
KevinQin
Obsidian | Level 7
The function COMPRESS should be OK.

Please try the code below:
data _null_;
a = "'00012345"""; *string with single quote and double quote;
put a=;
b = compress(a, "'""");
put b=;
run;
milts
Pyrite | Level 9
thanks a lot kevin! got it now
sfleming
Calcite | Level 5
There is also a third parameter to the compress function that can remove all characters of a certain type. For example, 'p' removes all punctuation characters.

data test;
x = "''x''";
y = '""y""';
z = cats(x, y);
w = compress(z,,'p');
run;
proc print data=test;
run;
What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 19654 views
  • 0 likes
  • 3 in conversation