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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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