SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

deleting different elements from a text

Accepted Solution Solved
Reply
Super Contributor
Posts: 413
Accepted Solution

deleting different elements from a text

hi,

suppose I have the following table:

text
The generalized general idea
Hon. member
some text

In every cell, whenever they are present, I would like to delete the following elements: 'The' , 'general' , 'Hon.' .

So the table becomes the following:

text
generalized idea
member
text

Thank you!


Accepted Solutions
Solution
‎05-15-2015 06:42 PM
Super Contributor
Posts: 275

Re: deleting different elements from a text

data have;

input text $50.;

cards;

The generalized general idea

Hon. member

some text

;

run;

data want;

   set have;

   _text=prxchange('s/Hon.|some|the|general\b//i',-1,text);

run;

View solution in original post


All Replies
Super User
Posts: 10,500

Re: deleting different elements from a text

https://communities.sas.com/thread/76418 is a similar thread, you may get some ideas.

Solution
‎05-15-2015 06:42 PM
Super Contributor
Posts: 275

Re: deleting different elements from a text

data have;

input text $50.;

cards;

The generalized general idea

Hon. member

some text

;

run;

data want;

   set have;

   _text=prxchange('s/Hon.|some|the|general\b//i',-1,text);

run;

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 231 views
  • 3 likes
  • 3 in conversation