![]() Chapter Contents |
![]() Previous |
![]() Next |
| SUBSTR (left of =) |
| Category: | Character |
| Syntax | |
| Arguments | |
| Details | |
| Examples | |
| See Also |
Syntax |
| SUBSTR(argument,position<,n>)=characters-to-replace |
| Restriction: | n can not be larger than the length of the expression that remains in argument after position. |
| Tip: | If you omit n SAS uses all of the characters on the right side of the assignment statement to replace the values of argument. |
| Tip: | Enclose a literal string of characters in quotation marks. |
| Details |
When you use the SUBSTR function on the left side of an assignment statement, SAS places the value of argument with the expression on right side. SUBSTR replaces n characters starting at the character you specify in position.
| Examples |
| SAS Statements | Results |
|---|---|
a='KIDNAP'; substr(a,1,3)='CAT'; put a; |
CATNAP |
b=a; substr(b,4)='TY'; put b; |
CATTY |
| See Also |
| Function:
|
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.