Quiz:
Reading
Variable-Length Records
Select the best answer for each question and click Score My Quiz.
- Variable-length records
- Which of the following is not
true for the LENGTH= option?
- Which SAS statement reads the
values for
SSN (in the first field) and holds the current
record until the DATA step begins the next iteration?
1---+----10---+----20---+ |
182-04-7814ASPDEN530 |
302-57-5023ATWOOD480 |
123-89-8470BROSNAN560 |
- Which SAS statement creates a
variable, named
namelen , whose value is the width of
Name (in the second field) in each record? Assume that
the total length of each record is assigned to a variable named reclen .
1---+----10---+----20---+ |
182-04-7814ASPDEN530 |
302-57-5023ATWOOD480 |
123-89-8470BROSNAN560 |
- Which SAS statement correctly
reads the values for
Name (in the second field) and Score
(in the third field)? Assume that the variable namelen
is used to determine the width of the Name field in each
record.
1---+----10---+----20---+ |
182-04-7814ASPDEN530 |
302-57-5023ATWOOD480 |
123-89-8470BROSNAN560 |
- What happens when the values for
Name and Office are read during the second
iteration of the DATA step?
1---+----10---+----20 |
3124Feldman1014 |
2112Fruchtenicht1015 |
1018Goodyear1013 |
2809Hardin1018 |
3205Matti1016 |
data perm.offices;
infile location length=reclen;
input ID 4. @;
namelen=reclen-8;
input Name $varying10. namelen Office;
run;
- Variable-length records can contain
. . .
- Which SAS statement repetitively
executes other statements based on the value of an index-variable
named
index ? Each repeating block of values for Date
(in the second field) and Score (in the third field)
needs to be read until the end of the current record. (HINT: The length
of each record is assigned to a variable named reclen .)
1---+----10---+----20---+----30---+- |
182-04-7814 09FEB98 530 |
302-57-5023 09FEB98 480 04MAY98
530 |
- When does this iterative DO loop
stop executing?
do index=7 to reclen by 10;
.
.
.
end;
- Which set of statements correctly
completes the DO loop?
1---+----10---+----20---+----30---+----40---+----50---+ |
102697
12JUN98 $210.73 12JUL98 $210.73 |
105898
30SEP98 $399.84 |
117397
15MAR99 $128.08 16APR99 $128.08 16MAY99 $127.01 |
data perm.customers;
infile payments length=reclen;
input ID 6. @;
do index=8 to reclen by 16;
?
?
?
run;
|