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;

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

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