SUBPAD Function


Returns a substring that has a length you specify, using blank padding if necessary

Category: Character

Syntax

SUBPAD ( string , position <, length >)

Arguments

string

  • specifies a character string.

position

  • is a positive integer that specifies the position of the first character in the substring.

length

  • is a non-negative integer that specifies the length of the substring. If you do not specify length , the SUBPAD function returns the substring that extends from the position that you specify to the end of the string.

Details

If the SUBPAD function returns a value to a variable that has not yet been assigned a length, by default the variable is assigned a length of 200.

If the substring that you specify extends beyond the length of the string, the result is padded with blanks.

Comparisons

The SUBPAD function is similar to the SUBSTR function except for the following differences:

  • If the value of length in SUBPAD is zero, SUBPAD returns a zero-length string. If the value of length in SUBSTR is zero, SUBSTR

    • writes a note to the log stating that the third argument is invalid

    • sets _ERROR_=1

    • returns the substring that extends from the position that you specified to the end of the string.

  • If the substring that you specify extends past the end of the string, SUBPAD pads the result with blanks to yield the length that you requested . If the substring that you specify extends past the end of the string, SUBSTR

    • writes a note to the log stating that the third argument is invalid

    • sets _ERROR_=1

    • returns the substring that extends from the position that you specified to the end of the string.

See Also

Function:

  • 'SUBSTRN Function' on page 840




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