
Example
The following SAS statements produce these results:
SAS Statement Result
a='KIDNAP';
substr(a, 1, 3)='CAT';
put a;
CATNAP
b=a;
substr(b, 4)='TY';
put b;
CATTY
See Also
Functions:
• “SUBSTR (right of =) Function” on page 933
SUBSTR (right of =) Function
Extracts a substring from an argument.
Category: Character
Restriction: I18N Level 0 functions are designed for use with Single Byte Character Sets (SBCS)
only.
Tip: DBCS equivalent functions are KSUBSTR and KSUBSTRB.
Syntax
<variable=>SUBSTR(string, position <, length>)
Required Arguments
string
specifies a character constant, variable, or expression.
position
specifies a numeric constant, variable, or expression ...