BookmarkSubscribeRSS Feed
daniele_1306
Calcite | Level 5

I would need to extract the first three consonants for each element of a list. Can someone help me?

thank you very much

 

LIST                 TO BE

PAROLA           PRL

LIBRO              LBR

NEWSPAPER  NWS

1 REPLY 1
andreas_lds
Jade | Level 19

Use compress-function to remove vowels, then substr to get the first three chars.

 

consonants = substr(compress(word, 'aeiou', 'i'), 1, 3);

 

if you are 100% sure that you have only upcase letters in your list, than use

consonants = substr(compress(word, 'AEIOU'), 1, 3);

 

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1312 views
  • 2 likes
  • 2 in conversation