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;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 338 views
  • 0 likes
  • 3 in conversation