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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 769 views
  • 0 likes
  • 3 in conversation