![]() Chapter Contents |
![]() Previous |
![]() Next |
| SUBSTR (right of =) |
| Category: | Character |
| Syntax | |
| Arguments | |
| Details | |
| Examples | |
| See Also |
Syntax |
| <variable=>SUBSTR(argument,position<,n>) |
| Interaction: | If n is larger than the length of the expression that remains in argument after position, SAS extracts the remainder of the expression. |
| Tip: | If you omit n, SAS extracts the remainder of the expression. |
| Details |
The SUBSTR function returns a portion of an expression that you specify in argument. The portion begins with the character specified by position and is the number of characters specified by n.
A variable that is created by SUBSTR obtains its length from the length of argument.
| Examples |
| SAS Statements | Results |
|---|---|
----+----1----+----2 |
|
date='06MAY98'; month=substr(date,3,3); year=substr(date,6,2); put @1 month @5 year; |
MAY 98 |
| See Also |
| Function:
|
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.