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
Load the column into an array, looping one character at a time. Then, count the members of the array that you consider consonants.
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;
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;
How will you decide whether the letter "Y" is a vowel or not?
Objective is to find mistyping
Ex -
looking more for things like strkct instead of strict
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"?)
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.
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.
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.
There used to be a dictionary or spelling procedure. I don't know if it still exists.
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.
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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.