SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Jianan_luna
Obsidian | Level 7

I am currently taking advanced programming course in SAS. When I did the demo problem(course 3, demo-p302d04), I am confused about the comprehension about the PRXMATCH function. I know the prxmatch is to search the first position of the character. But I cannot make sense the output table responding to the code created. Can you please help me to learn how to comprehend the result following? Thanks so much!

Jianan_luna_0-1597782687399.png

 

 

 Loc=prxmatch('/([2-9]\d\d)-([2-9]\d\d)-(\d{4})/',Phone);

 

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

PRXMATCH returns the beginning position of a substring that matches your regular expression. [2-9] for example matches any digit between 2 and 9, \d matches any digit, a dash matches a dash. Parentheses are used to delimit sub matches that can be extracted with the function PRXPOSN, once a match is found with PRXMATCH.

 

Search the web - there are plenty of tutorials about regular expressions and their use.

PG

View solution in original post

1 REPLY 1
PGStats
Opal | Level 21

PRXMATCH returns the beginning position of a substring that matches your regular expression. [2-9] for example matches any digit between 2 and 9, \d matches any digit, a dash matches a dash. Parentheses are used to delimit sub matches that can be extracted with the function PRXPOSN, once a match is found with PRXMATCH.

 

Search the web - there are plenty of tutorials about regular expressions and their use.

PG

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 1 reply
  • 709 views
  • 0 likes
  • 2 in conversation