Reading Variable-Length Records |
Reading Variable-Length Fields |
Reading Character Variables with Varying Lengths
When the DATA step has completely executed, you can use PROC PRINT to display
the data set. Notice that the variable |
proc print data=perm.phones; run; |
Obs | ID | namelen | Name | PhoneExt |
1 | 1802 | 7 | JOHNSON | 2123 |
2 | 1803 | 6 | BARKER | 2142 |
3 | 1804 | 9 | EDMUNDSON | 2325 |
4 | 1805 | 6 | RIVERS | 2543 |
5 | 1806 | 5 | MASON | 2646 |
6 | 1807 | 7 | JACKSON | 2049 |
7 | 1808 | 4 | LEVY | 2856 |
8 | 1809 | 6 | THOMAS | 2222 |
9 | 1810 | 6 | WARREN | 2003 |
10 | 1811 | 11 | VANDENBERGH | 2110 |
A variable defined by the LENGTH= option is not stored as
part of the observation. So when you display the data set by using PROC PRINT,
values for reclen are not shown. Instead, the minimum and maximum
values of reclen are noted in the SAS log. |
NOTE: 14 records were read from the infile PHONEDAT. The minimum record length was 12. The maximum record length was 19. NOTE: The data set PERM.PHONES has 14 observations and 4 variables. |
If you do not want to print the variable
namelen , you can use the DROP= option in the PRINT statement. |
proc print data=perm.phones (drop=namelen); run; |
Obs | ID | Name | PhoneExt |
1 | 1802 | JOHNSON | 2123 |
2 | 1803 | BARKER | 2142 |
3 | 1804 | EDMUNDSON | 2325 |
4 | 1805 | RIVERS | 2543 |
5 | 1806 | MASON | 2646 |
6 | 1807 | JACKSON | 2049 |
7 | 1808 | LEVY | 2856 |
8 | 1809 | THOMAS | 2222 |
9 | 1810 | WARREN | 2003 |
10 | 1811 | VANDENBERGH | 2110 |
Copyright © 2002 SAS Institute Inc.,
Cary, NC, USA. All rights reserved.