Professional Documents
Culture Documents
Chapter Quiz 4
Chapter Quiz 4
1. Which SAS statement associates the fileref Crime with the raw data file C:\States\Data\
crime.dat?
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
a. options obs=7;
out=exam
dbms=dlm
replace;
getnames=yes;
run;
run;
b. options obs=7;
out=exam
dbms=dlm
replace;
delimiter='.';
getnames=yes;
run;
run;
out=exam
dbms=dlm
replace;
delimiter=' ';
getnames=no;
run;
run;
out=exam
dbms=csv
replace;
delimiter=',';
getnames=no;
run;
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?
b. the name and location (using another libref) of the new SAS data set
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;
dbms=csv
out=class1
replace;
getnames=yes;
run;
dbms=dlm
out=workbook
replace;
getnames=yes;
run;
dbms=dlm
out=class01work
replace;
getnames=yes;
run;
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.
8. To override the DATA step default behavior that writes observations to output, what
b. an OUTPUT statement
c. an OUT= option
d. a BY statemen