BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Ramakanthkrovi
Obsidian | Level 7

Hi All, good morning.

Considering I have a string "WEIGHTMANAGEMENT", is it possible in SAS to extract the words "Weight", "Manage" and "Management" without me specifying what to search but SAS producing all the possible words in a string?

 

Thanks and Regards,

Rama

1 ACCEPTED SOLUTION

Accepted Solutions
KachiM
Rhodochrosite | Level 12

Ram,

It is difficult to look for meaningful words in a string by SAS programming. Perhaps a built-in dictionary might be useful. However, I wonder whether you can rephrase your requirement such that you give some N number of predefined words and look for the occurrence any such word(s) within the String. You may ask for the number of words found in each of the Strings.

regards,

DataSp

View solution in original post

6 REPLIES 6
Astounding
PROC Star

So you also want:

 

we

man

manage

a

an

nag

age

gem

men

 

???

Ramakanthkrovi
Obsidian | Level 7

Yes, but I can restrict the number of characters per word then isn't it?

ballardw
Super User

Look very closely at your list of "words" that you need to extract. This may be possible but order of processing may be important such as If I find "management" do I continue to look for "manage".

The more similar words you want to find the more complicated something like this gets. For instance if you also have to search for "MAN" or "EIGHT".

 

Do you know the words you want to search for or are you hoping to find a generic English (or other) language parser that could decipher:

"THISISASENTENCEWITHOUTANYSPACES". A native English speaker can probably decipher that phrase but I really would hate to try to program something to do that.

 

You might provide a larger number of examples and search words to work with, and to show the desired output.

Note that if want this to work with misspellings such as "WEIGHTMANAGEMNET" that is going to make this likely an order of magnitude more complicated.

 

SAS does have tools for  more complex text processing in the SAS Text Miner module.

PGStats
Opal | Level 21

Google does it:

 

Capture Google.PNG

PG
ballardw
Super User

@PGStats wrote:

Google does it:

 

Capture Google.PNG


And how much time and $ was spent by Google to accomplish this.

I won't mention how many times Google tries to split my actual search terms incorrectly though.

KachiM
Rhodochrosite | Level 12

Ram,

It is difficult to look for meaningful words in a string by SAS programming. Perhaps a built-in dictionary might be useful. However, I wonder whether you can rephrase your requirement such that you give some N number of predefined words and look for the occurrence any such word(s) within the String. You may ask for the number of words found in each of the Strings.

regards,

DataSp

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 1926 views
  • 7 likes
  • 5 in conversation