DATA Step, Macro, Functions and more

Remove brackets in a string

Reply
Super Contributor
Posts: 713

Remove brackets in a string

A+(B+C)

(A+B)+C

(A+B+C)

 

How to remove brackets so the string is A+B+C?

PROC Star
Posts: 1,283

Re: Remove brackets in a string

Use COMPRESS Function like this

 

data have;
input string $;
datalines;
A+(B+C)
(A+B)+C
(A+B+C)
;

data want;
   set have;
   string=compress(string, "()");
run;
Ask a Question
Discussion stats
  • 1 reply
  • 66 views
  • 2 likes
  • 2 in conversation