6: Exporting Data Flashcards
Which statement is false concerning the options for the PROC EXPORT statement?
a. The DATA= option identifies the input SAS table. b. The REPLACE option specifies to overwrite an existing file. c. The DBMS= option specifies the database identifier for the type of file being created. d. The OUT= option specifies the path and file name of the external data file being created.
D
The OUTFILE= (not OUT=) option specifies the path and filename of the external data file being created.
Which PROC EXPORT step contains valid syntax?
a. proc export outfile=”c:\temp\cars.txt” tab
data=sashelp.cars replace; run;
b. proc export data=sashelp.cars dbms=csv outfile="c:\temp\cars.csv"; run; c. proc export data=sashelp.class; dbms=csv; outfile="c:\temp\cars.csv"; run; d. proc export dbms=tab data=sashelp.cars replace=yes outfile="c:\temp\cars.txt"; run;
B
DATA=, DBMS=, and OUTFILE= are valid PROC EXPORT options. For answer a, DBMS= is missing in front of TAB. For answer c, there shouldn’t be semicolons after each option. For answer d, =YES is not valid after REPLACE.
What does the following program create?
libname sales xlsx ‘c:\mydata\midyear.xlsx’;
data sales.q1_2018; set sasdata.qtr1_2018; run; data sales.q2_2018; set sasdata.qtr2_2018; run;
a. two SAS tables: sales.q1_2018 and sales.q2_2018 b. two Excel workbooks: sales.q1_2018 and sales.q2_2018 c. two worksheets in the Excel workbook: midyear: q1_2018 and q2_2018 d. two worksheets in the Excel workbook: sales: q1_2018 and q2_2018
C
The LIBNAME statement specifies the Excel workbook midyear. The DATA statements create the worksheets q1_2018 and q2_2018 within the workbook midyear. The library reference of sales is what links the LIBNAME and DATA statements.
Which statement disassociates the sales libref?
libname sales xlsx ‘c:\mydata\midyear.xlsx’;
a. libname sales end; b. libname sales clear; c. libname sales close; d. libname sales disassociate;
B
The CLEAR option in the LIBNAME statement disassociates one or more currently assigned librefs.
What type of output file does this program create?
libname mylib xlsx “s:/workshop/output/test.xlsx”;
data class_list;
set sashelp.class;
run;
a. SAS table b. delimited file c. Microsoft Excel XLS file d. Microsoft Excel XLSX file
A
The DATA statement references class_list. A libref is not specified, so the work library is assumed. Work.class_list is a temporary SAS table.
Which of these programs creates a Microsoft Excel file?
a. ods excel file=”s:/workshop/output/class.xlsx”;
proc print data=sashelp.class;
run;
ods excel close;
b. libname mylib xlsx "s:/workshop/output/class.xlsx"; data mylib.class_list; set sashelp.class; run; c. both d. neither
C
Both ODS EXCEL and the LIBNAME statement with the XLSX engine create Excel workbooks.
Which of the following is not a valid ODS statement?
a. ods csvall file='c:\temp\myfile.csv'; b. ods pdf file='c:\temp\myfile.pdf'; c. ods powerpoint file='c:\temp\myfile.ppt'; d. ods word file='c:\temp\myfile.doc';
D
WORD is not a valid destination for the ODS statement. The RTF destination creates a file that can be opened by word processors: ods rtf file=’c:\temp\myfile.rtf’;
Which statement needs to be added to the end of this program?
ods pdf file=’c:\temp\myfile.pdf’;
proc print data=sashelp.class;
run;
a. ods clear; b. ods close; c. ods pdf clear; d. ods pdf close;
D
The CLOSE argument closes the destination and the file that is associated with it.
Which statement is false concerning the options for the ODS statement?
a. The STYLE= option names the desired font. b. The FILE= option specifies the output file to create. c. The STARTPAGE= option controls the behavior of page breaks. d. The PDFTOC= option controls the level of the expansion of the table of contents in PDF documents.
A
The STYLE= option names the style to use in the output file. The style controls visual aspects such as colors and fonts.
Which statement contains valid syntax for specifying a worksheet name?
a. ods excel sheet_name='Males'; b. ods excel (sheet_name='Males'); c. ods excel option(sheet_name='Males'); d. ods excel options(sheet_name='Males');
D
SHEET_NAME= is a sub-option that goes in a set of parentheses for the OPTIONS option.