Help using Base SAS procedures

Reg:Extraction particular part from a observation

Reply
N/A
Posts: 0

Reg:Extraction particular part from a observation

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
Super Contributor
Super Contributor
Posts: 3,174

Re: Reg:Extraction

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
Super Contributor
Posts: 474

Re: Reg:Extraction particular part from a observation

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.
Ask a Question
Discussion stats
  • 2 replies
  • 58 views
  • 0 likes
  • 3 in conversation