BookmarkSubscribeRSS Feed
nikunjgattani
Obsidian | Level 7

Hi,


I have a string column named "Column_Test" which cotains text up to 200 characters.
I want to identify those rows/ids where "Column_Test" value has 5 or more consonants without vowel.

Could anyone help me on this ?

 

Thanks
Nikunj

15 REPLIES 15
tomrvincent
Rhodochrosite | Level 12

Load the column into an array, looping one character at a time.  Then, count the members of the array that you consider consonants.

novinosrin
Tourmaline | Level 20

Hope this helps:


data have;
input Column_Test $50.;
datalines;
ABCEDIFOGUHJKLMNPQRSTVXZ
;

data want;
set have;
want=length((compress(Column_Test,'AEIOU','L')));
if want>5 then put '5 or more consonants without vowel';
run;
PaigeMiller
Diamond | Level 26

Use the COUNTC function to find if there are voewls. Then use length to count the length of the string;

 

data want;
     y = 'dfktbcpl';
     nvowels=countc(y,'aeiouy');
     length=length(y);
run;
--
Paige Miller
Astounding
PROC Star

How will you decide whether the letter "Y" is a vowel or not?

nikunjgattani
Obsidian | Level 7

Objective is to find mistyping

Ex - 

looking more for things like strkct instead of strict

 

Astounding
PROC Star

So for the exceptions, like "strengths" you are willing to inspect them to see if they are valid?  (You still need to decide whether "Y" qualifies as a vowel.  Is "tryst" a valid word or a mis-spelling?  How about "encrypts"?)

nikunjgattani
Obsidian | Level 7

Yes, you were correct. 'Y' should also be included as vowel.

 

I have included 'Y' in my solution. I have posted the solution too in one of the comment.

ballardw
Super User

Spaces? Punctuation? Special Characters such as @#$%^&*()_-=+.

Is this supposed to be contiguous consonants or to the above not "reset" the count.

 

Might want to provide some concrete examples and whether they meet the requirement or not.

nikunjgattani
Obsidian | Level 7

Objective is to find mistyping

Ex - 

looking more for things like strkct instead of strict

 

 

Yes, we have to reset the counter once it got vowel in the string and again start counting. 

We have to ignore spaces, punctuation and special character.

Reeza
Super User

There used to be a dictionary or spelling procedure. I don't know if it still exists.

Reeza
Super User

I think you're better off doing a dictionary search. You can find lists online. Flag anything not a valid word and then build your rules from there. 

nikunjgattani
Obsidian | Level 7
Hi,

Here we are not looking for a correct word but a mistyped word. Text
contains various places name too that are not a part of dictionary word.
We just want to capture those rows which has more than five consonants
appearing in a string continuously.
Then, we will manually review whether it is mistyped or not.
I Hope I am able explain my question.
Reeza
Super User

So a mistyped word will not end up in the list and then you can check it...am I missing something?

What defines a 'mistyped' word is your actual problem.

nikunjgattani
Obsidian | Level 7
We have to find a mistyped word.
So, to capture mistyped word we came up with a logic that any word which
doesn't have vowels in it could be mistyped.
On the top of that we added that if the count of consonants(continuous)
should be greater than 5 or more then only we call them mistyped.

*This column contains addresses.

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
  • 15 replies
  • 1487 views
  • 2 likes
  • 7 in conversation