BookmarkSubscribeRSS Feed
sachink
Calcite | Level 5

I need to replace value in a string - "the enddate of employee1 is 15/10/2012" to "the enddate of employee1 is". I am using tranwrd function as x1 = (x,"15/10/2012"," ");

This doesn't seem to be working. Any advise?

2 REPLIES 2
Ksharp
Super User

data _null_;

a="the enddate of employee1 is 15/10/2012";

b=prxchange('s/\d+\/\d+\/\d+//',-1,a);

put a= b=;

run;

Jagadishkatam
Amethyst | Level 16

I am not sure if you have actually tried the below code with tranwrd function. This is working, please check

data have;

length x $200.;

x="the enddate of employee1 is 15/10/2012";

x1 = tranwrd(x,"15/10/2012"," ");

run;

Thanks,

Jag

Thanks,
Jag

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 876 views
  • 1 like
  • 3 in conversation