BookmarkSubscribeRSS Feed
Smitha9
Fluorite | Level 6

I have a dataset,

Sara.Ph.D

Ali PHD

Bran MD

 

I want remove the .PH.D and PHD and MD

want dataset:

Sara

Ali

Brian

2 REPLIES 2
Reeza
Super User
Use the SCAN() function to extract the characters before the space or period.

FirstName = scan(word, 1, ". ");
Ksharp
Super User
data have;
input x $40.;
cards;
Sara.Ph.D
Ali PHD
Bran MD
;
data want;
 set have;
 want=prxchange('s/\b(phd|ph\.d|md)\b//i',-1,x);
run;

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 393 views
  • 0 likes
  • 3 in conversation