CHANGE Call
searches and replaces text in an array
- CALL CHANGE( matrix, old, new<,
numchange>);
The inputs to the CHANGE call are as follows:
- matrix
- is a character matrix or quoted literal.
- old
- is the string to be changed.
- new
- is the string to replace the old string.
- numchange
- is the number of times to make the change.
The CHANGE subroutine changes the first
numchange
occurrences of the substring
old in each element
of the character array
matrix to the form
new.
If
numchange is not specified, the routine defaults to 1.
If
numchange is 0, the routine
changes all occurrences of
old.
If no occurrences are found, the matrix is not changed.
For example, consider the following statements:
a="It was a dark and stormy night.";
call change(a, "night","day");
The result of these statements is as follows:
A="It was a dark and stormy day."
In the
old operand, the following characters are reserved:
| % $ [ ] { } < > - ? * # @ ' `(backquote) ^ |
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.