Hi
I think following is the simplest thing we can do to get the required:
data new;
input text $50.;
datalines;
1.YOUR NAME IS 'SANJEEV.'
2.YOUR NAME IS 'SRINATH.'
333.Your name is anything.
;
data this;
set new;
text2 = substr(text, find(text,'.')+1);
run;
Which word u want in the above example
I would use verify() to locate the first character of the name like
namepart = substr( text, verify( text, '0123456789 .' ));
Hi Sanjeev,
This code may will help you..
data have;
input number text&$30.;
cards;
1 1.YOUR NAME IS 'SANJEEV.'
2 2.YOUR NAME IS 'SRINATH.'
;
run;
proc print;
run;
data want;
set have;
/*text=compress(text,'.','d');*/
text =substr(strip(text),indexc(text ,'.')+1,length(text )-indexc(text ,'.'));
proc print;run;
Thanks,
Yaswanth J.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.