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-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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