Help using Base SAS procedures

Reg:Extraction particular part from a observation

Not applicable
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,176

Re: Reg:Extraction

Posted in reply to deleted_user
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

Processing a DATA Step: A Walkthrough

Adding Information to a SAS Data Set

A Hands-On Introduction to SAS® DATA Step Programming
Debbie Buck, D. B. & P. Associates, Houston,
Super Contributor
Posts: 474

Re: Reg:Extraction particular part from a observation

Posted in reply to deleted_user
Identical issue of your previous posts.

So, once again here's the answer:

Check here for regular expression info:

Check here for the regular expression functions online documentation:

Cheers from Portugal.

Daniel Santos @
Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation