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);

 

 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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
  • 1370 views
  • 2 likes
  • 2 in conversation