Regular Expressions in SAS®Enterprise Guide®Mark Tabladillo Ph.D.http://www.marktab.com@marktabnet
Introduction Regular expressions are the foundation of character  pattern matching Textual data is increasingly importan...
Outline Guide for Migrating from SAS (RX) expressions to Perl  (PRX) regular expressions Best practices for Perl Regular...
How to Migrate from SAS(RX) to Perl(PRX) Regular Expressions
Upgrade to Perl (PRX) Regular ExpressionsSAS (RX)      Perl (PRX)     DescriptionRXPARSE       PRXPARSE       Compiles a r...
How to Best Use Perl RegularExpressions
Categories of Regular ExpressionCommandsCategory        Single-Line   Proc SQL   Data Step   Macro                CommandA...
Regular Expression Commands (1 of 3)            Description              Accepts Perl   Accepts Regular     Has a CallComm...
Regular Expression Commands (2 of 3)           Description                Accepts Perl   Accepts Regular     Has a CallCom...
Regular Expression Commands (3 of 3)            Description                Accepts Perl   Accepts Regular     Has a CallCo...
Advanced Regular ExpressionCommands
Commands                     DescriptionPerl (PRX)CALL PRXPOSN      Returns the start position and length for a capture bu...
Demos
Conclusion See the Paper for Details    Guide for Migrating from SAS (RX) expressions to Perl (PRX)     regular expressi...
Abstract In version 9, the SAS® System introduces Perl regular  expressions (sometimes known by the acronym PRX,  the fir...
Mark Tabladillo / MarkTab Consulting
Upcoming SlideShare
Loading in...5
×

Regular Expressions in SAS Enterprise Guide

1,171

Published on

In version 9, the SAS® System introduces Perl regular expressions (sometimes known by the acronym PRX, the first three letters of these functions or call routines). However, previous versions of SAS® already had regular expressions (known by their acronym RX, the first two letters of these functions or call routines). This presentation will describe specific functional and performance differences in these two exclusive regular expression strategies, and offer recommendations on when to use each strategy. The technologies will be compared using SAS Enterprise Guide® 4.3.

Published in: Business, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,171
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
11
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Regular Expressions in SAS Enterprise Guide

  1. 1. Regular Expressions in SAS®Enterprise Guide®Mark Tabladillo Ph.D.http://www.marktab.com@marktabnet
  2. 2. Introduction Regular expressions are the foundation of character pattern matching Textual data is increasingly important in predictive analytics SAS Enterprise Guide® offers regular expression processing
  3. 3. Outline Guide for Migrating from SAS (RX) expressions to Perl (PRX) regular expressions Best practices for Perl Regular Expressions Advanced Perl Regular Expression Capabilities Demo
  4. 4. How to Migrate from SAS(RX) to Perl(PRX) Regular Expressions
  5. 5. Upgrade to Perl (PRX) Regular ExpressionsSAS (RX) Perl (PRX) DescriptionRXPARSE PRXPARSE Compiles a regular expression (RX or PRX) that can be usedFunction Function for pattern matching of a character valueRXMATCH PRXMATCH Searches for a pattern match and returns the position at whichFunction Function the pattern is foundCALL CALL Returns the position and length of a substring that matches aRXSUBSTR PRXSUBSTR pattern (RX includes score)Routine RoutineCALL CALL Performs a pattern-matching replacementRXCHANGE PRXCHANGERoutine Routine PRXCHANGE FunctionCALL RXFREE CALL PRXFREE Frees unneeded memory allocated for a regular expressionRoutine Routine (either RX or PRX)
  6. 6. How to Best Use Perl RegularExpressions
  7. 7. Categories of Regular ExpressionCommandsCategory Single-Line Proc SQL Data Step Macro CommandAccepts Perl YES YES YES YESRegularExpressionAccepts no YES YES YESRegularExpression IDHas CALL no no YES YESRoutineVariant
  8. 8. Regular Expression Commands (1 of 3) Description Accepts Perl Accepts Regular Has a CallCommand Regular Expression ID Routine Variant ExpressionPRXCHANGE Performs a pattern- YES YES YES matching replacement.PRXDEBUG Enables Perl regular no no YES expressions in a DATA step to send debugging output to the SAS log.PRXFREE Frees memory that was no no YES allocated for a Perl regular expression.
  9. 9. Regular Expression Commands (2 of 3) Description Accepts Perl Accepts Regular Has a CallCommand Regular Expression ID Routine Variant ExpressionPRXMATCH Searches for a pattern YES YES no match and returns the position at which the pattern is found.PRXNEXT Returns the position no no YES and length of a substring that matches a pattern, and iterates over multiple matches within one string.PRXPAREN Returns the last bracket no YES no match for which there is a match in a pattern.
  10. 10. Regular Expression Commands (3 of 3) Description Accepts Perl Accepts Regular Has a CallCommand Regular Expression ID Routine Variant ExpressionPRXPARSE Compiles a Perl regular YES no no expression (PRX) that can be used for pattern matching of a character value.PRXPOSN Returns a character no YES YES string that contains the value for a capture buffer.PRXSUBSTR Returns the position no no YES and length of a substring that matches a pattern.
  11. 11. Advanced Regular ExpressionCommands
  12. 12. Commands DescriptionPerl (PRX)CALL PRXPOSN Returns the start position and length for a capture bufferRoutinePRXPOSN Function Returns the value for a capture bufferPRXPAREN Function Returns the last bracket match for which there is a match in a patternCALL PRXNEXT Returns the position and length of a substring thatRoutine matches a pattern and iterates over multiple matches within one stringCALL PRXDEBUG Enables Perl regular expressions in a DATA step to sendRoutine debug output to the SAS log
  13. 13. Demos
  14. 14. Conclusion See the Paper for Details  Guide for Migrating from SAS (RX) expressions to Perl (PRX) regular expressions  Best practices for Perl Regular Expressions  Advanced Perl Regular Expression Capabilities  Demo Contact  http://www.marktab.com  http://www.marktab.net  @marktabnet
  15. 15. Abstract In version 9, the SAS® System introduces Perl regular expressions (sometimes known by the acronym PRX, the first three letters of these functions or call routines). However, previous versions of SAS® already had regular expressions (known by their acronym RX, the first two letters of these functions or call routines). This presentation will describe specific functional and performance differences in these two exclusive regular expression strategies, and offer recommendations on when to use each strategy. The technologies will be compared using SAS Enterprise Guide® 4.3.
  16. 16. Mark Tabladillo / MarkTab Consulting
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×