| Reading Variable-Length Records |
| Reading Variable-Length Fields |
| Creating a Varying Size Length-Variable
Now let's think about how to give instructions for reading the values for
|
Let's call the length-variable namelen. As
you can see, the value of namelen varies. |
|
Raw Data File Phonedat
|
|
namelen= 7 namelen= 6 namelen= 9 namelen= 6 namelen= 5 |
data perm.phones;
infile phondat length=reclen;
input ID 4. @;
namelen=??????
|
But remember, each record contains only three fields and
the width of both ID and PhoneExt is 4 in every
record. So, the values for ID and PhoneExt take
up only 8 spaces in each record. Therefore, the value of namelen
is the length of each record (reclen) minus the length of
ID and PhoneExt(8). |
data perm.phones;
infile phondat length=reclen;
input ID 4. @;
namelen=reclen-8;
|
![]() ![]() |
|
Copyright © 2002 SAS Institute Inc.,
Cary, NC, USA. All rights reserved.