The authorization data set is used to determine which files can be served. The mechanism for making this decision is RX function pattern matching. This data set is used to set patterns (or masks) for the files that can be served. If a requested file does not match one of these patterns, then it is not served and an error message is issued.
The reserved name for the authorization data set is SASHELP.FSAUTH. The FILESRV program uses this data set to look up which files can be served. A sample copy of this file is provided with the FILESRV program. You can specify an alternate data set by using the AUTHDSN argument in the FILESRV autocall macro.
The authorization data set must contain 2 character variables:
FILETYPE
E
for an external
file and C
for a catalog entry.
This value is not case-sensitive.PATH
PATH
variable
specifies the pattern (or mask) that file must follow in order
for that file to be served.This value is case-sensitive only if the host operating system honors case-sensitive filenames. For example, the values that you specify for UNIX systems are case-sensitive but values that you specify for 0S/390 systems are not.
When creating a pattern for matching, make the pattern as short as possible for greater efficiency. The time required for matching is roughly proportional to the length of the pattern times the length of the string that is searched.
To specify a literal that begins with a single quotation mark, use two single quotation marks instead of one.
Literals inside a pattern must be enclosed by another layer of quotation marks. For example, "` 'O''' connor" matches an uppercase O, followed by a single quotation mark, followed by the letters "connor" in either upper or lower case.
The value of the PATH
variable (the pattern)
can be made up of the following pattern elements.
Any file you want to serve must satisfy the conditions of all
the pattern elements that you specify in your pattern.
Pattern Element | Description |
---|---|
string-in-quotation-marks | matches a substring consisting of the characters in the string. |
letter | matches the upper- or lowercase letter in a substring. |
digit | matches the digit in a substring. |
period (.) | matches a period (.) in a substring. |
underscore (_) | matches an underscore (_) in a substring. |
question mark (?) | matches any one character in a substring. |
colon (:) | matches any sequence of zero or more characters in a substring. |
$'pattern' $"pattern" |
matches any one character in a substring.
Tip: Ranges of alphanumeric variables are indicated by the hyphen (-). Example: To match any lowercase letter, use $'a-z'
|
~'character-class' ^'character-class' ~"character-class" ^"character-class" |
matches any one character that is not matched
by the corresponding character class.
Tip: Ranges of alphanumeric variables are indicated by a hyphen (-). Example: To exclude the letters ^'a-d'
|
pattern1 || pattern2 | selects any substring matched by pattern1 followed immediately by any substring matched by pattern2 (with no intervening blanks). |
pattern1 | pattern2 | selects any substring matched by pattern1 or any substring matched by pattern2.
Tip: You can use an exclamation point (!) instead of a vertical bar (|). |
(pattern) | matches a substring that contains a pattern. You can use parentheses to indicate the order in which operations are performed. |
[pattern]
{pattern} |
matches a substring that contains a pattern or null string. |
pattern* | matches zero or more consecutive strings matched by a pattern. |
pattern+ | matches one or more consecutive strings matched by a pattern. |
@int | matches the position of a variable if the next character is located in the column specified by int. @0 matches end-of-line. If int is negative, it matches -int positions from end-of-line. |
reuse-character-class | reuses a character-class you previously defined. |
pattern-abbreviation | specifies ways to shorten pattern representation. |
balanced-symbols | specifies the number of nested parentheses, brackets, braces, or less-than/greater-than symbols in a mathematical expression. |
Using a character class element is a shorthand method for specifying a range of values for matching. In pattern matching, you can
Specify a default character class with a dollar sign ($) followed by a single upper- or lowercase letter. The following table lists the default character classes and their definitions.
Character Class |
Class Definition |
---|---|
$a $A |
matches any alphabetic upper- or lowercase letter in a substring ($'a-zA-Z'). |
$c $C |
matches any character allowed in a SAS name that is found in a substring ($'0-9a-zA-Z_'). |
$d $D |
matches any numeric digit in a substring ($'0-9'). |
$i $I |
matches any initial character in a SAS name that is found in a substring ($'a-zA-Z_'). |
$l $L |
matches any lowercase letter in a substring ($'a-z'). |
$u $U |
matches any uppercase letter in a substring ($'A-Z'). |
$w $W |
matches any white space character, such as blank, tab, backspace, and carriage return in a substring. |
See also: Character Class Complements |
Note: A hyphen that appears at the beginning or end of a character class is treated as a member of the class rather than as a range symbol.
A user-defined character class begins with a dollar sign ($) and is followed by a string (that you specify) in quotation marks. To match a user-defined character class, any one character must match one of the characters within the quotation marks.
Note: Ranges of values are indicated by a hyphen (-).
The examples below illustrate the use of user-defined character classes.
Pattern | Input string | Match |
---|---|---|
$'abcde' | 3+yE strikes | e |
$'1-9' | z0*549xy | 5 |
You can also define your own character class complements.
A character class complement begins with a caret (^) or a tilde (~) and is followed by a string in quotation marks. A character class complement matches any one character that is not matched by the corresponding character class.
The examples below illustrate the use of character class complements.
Pattern | Input string | Match |
---|---|---|
^u ~u |
0*5x49XY | The "0" |
^'A-z' ~'A-z' |
Abc de45 | The space between the "c" and the "d" |
You can reuse character classes that you previously defined by specifying one of the following patterns:
Pattern Element | Description | ||||
---|---|---|---|---|---|
$int | reuses the int'th character class.
|
||||
~int ^int |
reuses the complement of the int'th character class.
|
You can use the following list of elements in your pattern:
Pattern Element |
Description |
---|---|
$f $F |
matches a floating point number. |
$n $N |
matches a SAS name. |
$p $P |
indicates a prefix option. |
$q $Q |
matches a string in quotation marks. |
$s $S |
indicates a suffix option. |
The examples below illustrate the use of pattern abbreviations.
Pattern | Input string | Match |
---|---|---|
$p wood | woodchucks eat wood | characters "wood" in woodchucks |
wood $s | woodchucks eat wood | the word "wood" |
You can match mathematical expressions containing multiple sets of balanced parentheses, brackets, braces, and less-than/greater-than symbols. Both the symbols and the expressions within the symbols are part of the match:
Pattern Element |
Description | ||||
---|---|---|---|---|---|
$(int) $[int] ${int} $<int |
indicates the int level of nesting you specify.
|
The following example illustrates the use of matching balanced symbols.
Pattern | Input string | Match |
---|---|---|
$(2) | (((a+b)*5)/43) | ((a+b)*5) |
You can use the following list of special symbols in your pattern:
Symbol | Description | ||||
---|---|---|---|---|---|
\ | sets the beginning of a match to the current position. | ||||
/ | sets the end of a match to the current position.
| ||||
$# | requests the match with the highest score, regardless of the starting position.
| ||||
$- | scans a string from right to left.
| ||||
$@ | requires the match to begin
where the scan of the text begins.
|
The examples below illustrate the use of special symbols:
Pattern | Input string | Match |
---|---|---|
c\ow | How now brown cow? | characters "ow" in cow |
ow/n | How now brown cow? | characters "ow" in brown |
@3:\ow | How now brown cow? | characters "ow" in now |
When a pattern is matched by more than one substring beginning at a specific position, the longest substring is selected. To change the selection criterion, assign a score value to each substring by using the pound sign (#) special symbol followed by an integer.
The score for any substring begins at zero. When #int is encountered in the pattern, the value of int is added to the score. If two or more matching substrings begin at the same leftmost position, SAS selects the substring with the highest score value. If two substrings begin at the same leftmost position and have the same score value, SAS selects the longer substring. The following is a list of score representations:
Score | Description |
---|---|
#int | adds int to the score, where int is a positive or negative integer. |
#*int | multiplies the score by nonnegative int. |
#/int | divides the score by positive int. |
#=int | assigns the value of int to the score. |
#>int | finds a match if the current score exceeds int. |