3

35010 - Iterating through character values in a DATA step DO loop

 1 year ago
source link: http://support.sas.com/kb/35/010.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Sample 35010: Iterating through character values in a DATA step DO loop

In order to instruct a DATA step DO loop to iterate from one character value to another, you can use the RANK function to return the position or decimal value of a character in the ASCII or EBCDIC collating sequence. These values would represent your start and stop values for the DO loop. To retrieve the corresponding ASCII or EBCDIC character values for use within the DO block of code, you can use the BYTE function.

Here is a link to another sample showing how to iterate through character values within a MACRO %DO loop:
Sample #25961, Using character values on a macro %DO loop


These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK