CALL PRXDEBUG Routine


CALL PRXDEBUG Routine

Enables Perl regular expressions in a DATA step to send debug output to the SAS log

Category: Character String Matching

Restriction: Use with the CALL PRXCHANGE, CALL PRXFREE, CALL PRXNEXT, CALL PRXPOSN, CALL PRXSUBSTR, PRXPARSE , PRXPAREN, and PRXMATCH functions and CALL routines.

Syntax

CALL PRXDEBUG ( on-off );

Arguments

on-off

  • specifies a numeric value. If the value of on-off is positive and non-zero , then debugging is turned on. If the value of on-off is zero, then debugging is turned off.

Details

The CALL PRXDEBUG routine provides information about how a Perl regular expression is compiled, and about which steps are taken when a pattern is matched to a character value.

You can turn debugging on and off multiple times in your program if you want to see debugging output for particular Perl regular expression function calls.

For more information about pattern matching, see 'Pattern Matching Using SAS Regular Expressions (RX) and Perl Regular Expressions (PRX)' on page 260.

Comparisons

The Perl regular expression (PRX) functions and CALL routines work together to manipulate strings that match patterns. To see a list and short description of these functions and CALL routines, see the Character String Matching category in 'Functions and CALL Routines by Category' on page 270.

Examples

The following example produces debugging output.

 data _null_;        /* Turn the debugging option on. */     call prxdebug(1);     putlog 'PRXPARSE: ';     re = prxparse('/[bc]d(ef*g)+h[ij]k$/');     putlog 'PRXMATCH: ';     pos = prxmatch(re, 'abcdefg_gh_');        /* Turn the debugging option off. */        call prxdebug(0);  run; 

The following lines are written to the SAS log.

Output 4.6: SAS Log Results from CALL PRXDEBUG
start example
 PRXPARSE:  Compiling REx '[bc]d(ef*g)+h[ij]k$' [1]  size 41 first at 1  [2]  rarest char g at 0  [5]  rarest char d at 0     1: ANYOF[bc](10)  [3]    10: EXACT <d>(12)    12: CURLYX[0] {1,32767}(26)    14:   OPEN1(16)    16:     EXACT <e>(18)    18:     STAR(21)    19:        EXACT <f>(0)    21:     EXACT <g>(23)    23:   CLOSE1(25)    25:   WHILEM[1/1](0)    26: NOTHING(27)    27: EXACT <h>(29)    29: ANYOF[ij](38)    38: EXACT <k>(40)    40: EOL(41)    41: END(0)  anchored 'de' at 1 floating 'gh' at 3..2147483647 (checking floating)  [4]  stclass 'ANYOF[bc]' minlen 7 [6]                                  [4]  PRXMATCH:  Guessing start of match, REx '[bc]d(ef*g)+h[ij]k$' against 'abcdefg_gh_'...  Did not find floating substr 'gh'...  Match rejected by optimizer 
end example
 

The following items correspond to the lines that are numbered in the SAS log that is shown above.

[1]  

This line shows the precompiled form of the Perl regular expression.

[2]  

Size specifies a value in arbitrary units of the compiled form of the Perl regular expression. 41 is the label ID of the first node that performs a match.

[3]  

This line begins a list of program nodes in compiled form for regular expressions.

[4]  

These two lines provide optimizer information. In the example above, the optimizer found that the match should contain the substring de at offset 1, and the substring gh at an offset between 3 and infinity. To rule out a pattern match quickly, Perl checks substring gh before it checks substring de .

The optimizer might use the information that the match begins at the first ID (

 [2] 
),
[5]  

with a character class, and

[6]  

cannot be shorter than seven characters .

See Also

Functions and CALL routines:

  • 'CALL PRXCHANGE Routine' on page 354

  • 'CALL PRXFREE Routine' on page 358

  • 'CALL PRXNEXT Routine' on page 359

  • 'CALL PRXPOSN Routine' on page 361

  • 'CALL PRXSUBSTR Routine' on page 364

  • 'CALL PRXCHANGE Routine' on page 354

  • 'PRXCHANGE Function' on page 739

  • 'PRXPAREN Function' on page 747

  • 'PRXMATCH Function' on page 743

  • 'PRXPARSE Function' on page 748

  • 'PRXPOSN Function' on page 750




SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 704

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net