| Reading Variable-Length Records |
| Reading Variable-Length Fields |
| Reading Variable-Length Values
The next step involves reading the values of |
| The $VARYINGw. informat is a special SAS informat that enables you to read a character value, which has a length that differs from record to record. |
General form, INPUT statement with the
$VARYINGw.
informat:
where
|
| 1---+----10---+----20 |
| 1802JOHNSON2123 |
| 1803BARKER2142 |
| 1804EDMUNDSON2325 |
| 1805RIVERS2543 |
| 1806MASON2646 |
| 1807JACKSON2049 |
| 1808LEVY2856 |
| 1809THOMAS2222 |
| It's important to understand how the $VARYINGw. informat is different from other character informats. This informat is composed of two parts, the informat and the length variable. |
| INPUT variable $VARYINGw. length-variable; |
The second INPUT statement uses the $VARYINGw.
informat to read the values for Name from column 5 until the
length is specified by namelen. Then the values for
PhoneExt are read. |
data perm.phones;
infile phondat length=reclen;
input ID 4. @;
namelen=reclen-8;
input Name $varying10. namelen
PhoneExt;
|
![]() ![]() |
|
Copyright © 2002 SAS Institute Inc.,
Cary, NC, USA. All rights reserved.