04-11-2018 10:59 AM - edited 04-11-2018 10:59 AM
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 ?
04-11-2018 11:04 AM
Load the column into an array, looping one character at a time. Then, count the members of the array that you consider consonants.
04-11-2018 11:10 AM
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;
04-11-2018 11:12 AM
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;
04-11-2018 12:23 PM - edited 04-11-2018 12:53 PM
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"?)
04-16-2018 10:57 AM
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.
04-11-2018 11:37 AM
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.
04-11-2018 11:58 AM
Objective is to find mistyping
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.
04-11-2018 01:16 PM
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.
04-11-2018 02:08 PM
04-11-2018 02:37 PM
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.
04-11-2018 09:39 PM