BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Name string_final
Micheljohn Aaaaaaaaaa
VTG123 vijay AAA999 Aaaaa
John WER456 Aaaa AAA999.

In this above if the string_final is having the pattern AAA999 then that part should be moved to another variable.
As there are many observations and i dont know where this pattern will come in the string_final.

Name string_final output
ABC999 Aaaaaaaaaa ABC999
VTG123 vijay AAA999 Aaaaa VTG123
John WER456 Aaaa AAA999. WER456
2 REPLIES 2
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Using a DATA step to parse the SAS variable, you can use the FIND and SUBSTR functions to locate, extract and then assign the substring to another SAS variable.

Suggest you review the SAS Language Dictionary guide and the section on functions.

Scott Barry
SBBWorks, Inc.

Functions and CALL Routines
http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a000245852.htm


Processing a DATA Step: A Walkthrough
http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a000961108.htm


Adding Information to a SAS Data Set
http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/a001315210.htm


A Hands-On Introduction to SAS® DATA Step Programming
Debbie Buck, D. B. & P. Associates, Houston,
http://www2.sas.com/proceedings/sugi30/134-30.pdf
DanielSantos
Barite | Level 11
Identical issue of your previous posts.

So, once again here's the answer:

Check here for regular expression info:
http://www.regular-expressions.info/tutorial.html

Check here for the regular expression functions online documentation:
http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a002295977.htm

Cheers from Portugal.

Daniel Santos @ www.cgd.pt.

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