BookmarkSubscribeRSS Feed
SASPhile
Quartz | Level 8

How to split raw_variable into multiple variables of lengths 20 and not to break a word.

 

i.e in below example "acerbic soluable dio" is not the way to split it. dioxide;zinc goes to other variable and so on.

 

raw_variable
acerbic soluable dioxide;zinc titanium

 

Raw_var1                               Raw_Var2                  Raw_var3
acerbic soluable                     dioxide;zinc                 titanium

 

Thanks for the help!

2 REPLIES 2
Patrick
Opal | Level 21

It would be simpler to split up your string into single words. One could then still concatenate the words back into strings of up to 20 characters.

If re-concatenating words: Do you really need the semicolon in Raw_Var2 or could we just add a blank here?

 

What should happen if a single word has more than 20 characters?

SASPhile
Quartz | Level 8

 In fact the delimiters are semi-colons. So they are required. 

acerbic;soluable;carbon dioxide

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of 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
  • 2 replies
  • 632 views
  • 0 likes
  • 2 in conversation