Exercises and Projects for The Little SAS Book, Sixth Edition. Lora D. Delwiche
b. DATA dogs;
c. DATA sasdata.dogs;
d. None of the above
5. When using the following direct reference to create a permanent SAS data set in the Windows operating environment, what does the name dogs refer to?
DATA ‘c:\MySASLib\dogs’;
a. The drive
b. The directory
c. The filename
d. The libref
6. The descriptor portion of a SAS data set includes which of the following?
a. The SAS engine with which the data set was created
b. The date on which the data set was created
c. The number of variables and observations
d. All of the above
7. Which optional statement in PROC IMPORT tells SAS to expect a column that contains both character and numeric values?
a. GETNAMES = NO
b. GETNAMES = YES
c. MIXED = NO
d. MIXED = YES
8. Which PROC IMPORT option identifies the type of Microsoft Excel file to be read?
a. DELIMITER=
b. DBMS=
c. DATAROWS=
d. None of the above
9. If your raw data file contains only data and no variable names, which PROC IMPORT option should you use?
a. DELIMITER=
b. GUESSINGROWS=
c. GETNAMES=
d. OUT=
10. The data in the following program are an example of what type of data?
DATA readme;
INPUT Place $ Code $;
DATALINES;
AG 5678
SLO 1234
PB 3456
;
RUN;
a. Character
b. Instream
c. Internal raw data
d. All of the above
11. Which statement is synonymous with a DATALINES statement?
a. DATA
b. INFILE
c. CARDS
d. INPUT
12. Which SAS statement enables you to refer to an external raw data file?
a. DATALINES
b. DATA
c. INFILE
d. INPUT
13. Which of the following types of data cannot be read with list input?
a. Missing data indicated by a period
b. Date and time values
c. Standard numeric data
d. All of the above
14. Assuming that the raw data are arranged in neat columns, what is an advantage of column input?
a. It can read missing data indicated by spaces
b. It can read embedded blanks
c. It can read character data longer than eight characters
d. All of the above
15. With column input, you cannot do which of the following?
a. Read data separated by spaces
b. Specify an informat in the INPUT statement
c. Read numeric data in scientific notation
d. All of the above
16. Given this note in the SAS log, what could you add to fix the INPUT statement so that the ID variable would be read correctly including all digits and hyphens?
INPUT ID GPA Age;
NOTE: Invalid data for ID in line 1 1-9.
RULE: ----+----1----+----2
1 5437-2212 3.84 21
ID=. GPA=3.84 Age=21 _ERROR_=1 _N_=1
a. A dollar sign
b. A column range
c. An informat
d. None of the above
17. Which of the following data values would not require an informat?
a. 44.5E2
b. $1,689
c. 08/18/1920
d. 4,928
18. Which informat would be appropriate to read the value 07/04/1776?
a. MMDDYY8.
b. MMDDYY10.
c. DATE8.
d. DATE10.
19. Which input style is the best for reading date values from raw data?
a. List
b. Column
c. Formatted
d. All input styles can read date values
20. Select the INPUT statement that would be appropriate for reading data values for the variables Name, Salary, and Age in the following raw data.
----+----1----+----2----+----3
Sally $64,350 41
Marian $55,500 38
Oprah $75,000,000 59
a. INPUT Name $ Salary & DOLLAR11. Age;
b. INPUT Name $ Salary :DOLLAR11. Age;
c. INPUT Name $ @10 Salary DOLLAR11. Age;
d. INPUT Name $ @’$’ Salary Age;
21. Which of the following tells SAS to go to the next line when reading in data?
a. @
b. @@
c. /
d. +n
22. Which input style can be used with a double trailing @?
a. Column
b. List
c. Both can be used
d. Neither can be used
23. A record that is being held by a trailing @ will be released for which of the following reasons?
a. The current loop through the DATA step completes
b. SAS finds a subsequent INPUT statement with no line-hold specifier
c. Both of these
d. Neither of these
24. A record that is being held by a double trailing @ will be released for which of the following reasons?
a. The current loop through the DATA step completes
b. SAS finds a subsequent INPUT statement with no line-hold specifier
c. Both of these
d. Neither of these
25. Which of the following is a valid INFILE option that tells SAS to stop reading after the fifth line of raw data?
a. FIRSTOBS = 5
b. OBS = 5
c.