BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Linlin
Lapis Lazuli | Level 10

combining Art ant Tom's methods:

data x;

input VAR0 $40.;

cards;

ABC_F_P_LOW

DEF_K__HIGH

ZPQ_M_X_MEDIUM

GKL_J_B

;

data want;

set x;

array v{4} $ ;

do _n_=1 to 4;

  v{_n_}=scan(tranwrd(var0,'__','_ _'),_n_,'_');

end;

proc print;run;

                         obs    VAR0              v1     v2    v3    v4

                         1     ABC_F_P_LOW       ABC    F     P     LOW

                         2     DEF_K__HIGH       DEF    K           HIGH

                         3     ZPQ_M_X_MEDIUM    ZPQ    M     X     MEDIUM

                         4     GKL_J_B           GKL    J     B

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

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 15 replies
  • 3545 views
  • 7 likes
  • 8 in conversation