BookmarkSubscribeRSS Feed
Ronein
Onyx | Level 15

Hello

I have a data set that all values in column x start with "Team" value.

Task: Delete from all rows in column X the value "Team"

Existing values:

Team 2-5
Team 7-8
Team 9-11

 

New values should be:

2-5
7-8
 9-11

 

How can I do it please?

 

 

data aaa;
INFILE DATALINES DELIMITER=',' DSD;
input x1 $;
cards;
Team 2-5
Team 7-8
Team 9-11
;
run;

 

 

 

2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

One way

 

data have;
input x $20.;
datalines;
Team 2-5
Team 7-8
Team 9-11
;

data want;
    set have;
    newx=tranwrd(x, 'Team ', '');
run;
Shmuel
Garnet | Level 18

Alternatively you can use 

newx = scan(x,2,' ');

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

How to Concatenate Values

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 823 views
  • 0 likes
  • 3 in conversation