You are on page 1of 5

Chapter Quiz

Select the best answer for each question.

1. Which SAS statement associates the fileref Crime with the raw data file C:\States\Data\
crime.dat?

a. filename crime 'c:\states\data\crime.dat';

b. filename crime c:\states\data\crime.dat;

c. fileref crime 'c:\states\data\crime.dat';

d. filename 'c:\states\data\crime' crime.dat;

2. Which type of delimited file does PROC IMPORT read by default?

a. logical record-length files

b. varying record-length files

c. fixed record-length files

d. illogical record-length files

3. Which program correctly imports only the first seven lines from the external file that

is delimited by a period (.) ? Hint: the first line in the external file contains variable

names that you want to read in.

a. options obs=7;

proc import data="C:\users\test.txt"

out=exam

dbms=dlm

replace;

getnames=yes;

run;

proc print data=exam;

run;
b. options obs=7;

proc import datafile="c:\users\test.txt"

out=exam

dbms=dlm

replace;

delimiter='.';

getnames=yes;

run;

proc print data=exam;

run;

c. proc import datafile="c:\users\test.txt"

out=exam

dbms=dlm

replace;

delimiter=' ';

getnames=no;

run;

proc print data=exam (obs=7);

run;

d. proc import datafile="c:\users\test.txt"

out=exam

dbms=csv

replace;

delimiter=',';

getnames=no;

run;

proc print data=exam;

options obs=7;

run;
4. Which of the following pieces of information does SAS need in the DATA step in

order to read an Excel workbook file and write it out to a SAS data set?

a. a libref to reference the Excel workbook to be read

b. the name and location (using another libref) of the new SAS data set

c. the name of the Excel worksheet that is to be read

d. all of the above

5. Which statement should you use if you want PROC IMPORT to generate SAS

variable names from the values in the first row of an input file?

a. getnames=no;

b. datarow=1;

c. guessingrows=1;

d. getnames=yes;

6. Which SAS program correctly imports data from an external file?

a. filename workbook 'C:\certdata\class1.csv';

proc import datafile=workbook.class

dbms=csv

out=class1

replace;

getnames=yes;

run;

b. filename workbook 'C:\certdata\workbook.txt';

proc import datafile=workbook

dbms=dlm

out=workbook

replace;

getnames=yes;
run;

c. filename workbook 'C:\certdata\workbook.txt';

proc import datafile=class01

dbms=dlm

out=class01work

replace;

getnames=yes;

run;

d. all of the above.

7. Which delimited input file can be imported using PROC IMPORT?

a.

Region&State&Month&Expenses&Revenue

Southern&GA&JAN2001&2000&8000

Southern&GA&FEB2001&1200&6000

Southern&FL&FEB2001&8500&11000

Northern&NY&FEB2001&3000&4000

Northern&NY&MAR2001&6000&5000

Southern&FL&MAR2001&9800&13500

Northern&MA&MAR2001&1500&1000

b.

"Africa","Boot","Addis Ababa","12","$29,761","$191,821","$769"

"Asia","Boot","Bangkok","1","$1,996","$9,576","$80"

"Canada","Boot","Calgary","8","$17,720","$63,280","$472"

"Eastern Europe","Boot","Budapest","22","$74,102","$317,515","$3,341"

"Middle East","Boot","Al-Khobar","10","$15,062","$44,658","$765"

"Pacific","Boot","Auckland","12","$20,141","$97,919","$962"

"South America","Boot","Bogota","19","$15,312","$35,805","$1,229"

"United States","Boot","Chicago","16","$82,483","$305,061","$3,735"
"Western Europe","Boot","Copenhagen","2","$1,663","$4,657","$129"

c.

Region State Capital Bird

South Georgia Atlanta 'Brown Thrasher'

South 'North Carolina' Raleigh Cardinal

North Connecticut Hartford Robin

West Washington Olympia 'American Goldfinch'

Midwest Illinois Springfield Cardinal

d. all of the above

8. To override the DATA step default behavior that writes observations to output, what

should you use in a DATA step?

a. DROP= and KEEP= data set options

b. an OUTPUT statement

c. an OUT= option

d. a BY statemen

You might also like