Ch 3: Accessing Your Data Flashcards

1
Q
How long do librefs remain in effect?
a.
until the LIBNAME statement is changed
b.
until the LIBNAME statement is cleared
c.
until the SAS session ends
d.
all of the above
A

Correct answer: d

Librefs remain in effect until the LIBNAME statement is changed, canceled, or until the SAS session ends

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which of the following statements are true?
a.
When using the default engine, you do not have to specify the libref in the LIBNAME statement.
b.
When using the default engine, you do not have to specify the engine name in the LIBNAME statement.
c.
When using the default engine, you do not have to specify the SAS library in the LIBNAME statement.
d.
When using the default engine, you have to specify the libref, engine name, and the SAS library in the LIBNAME statement.

A

Correct answer: b
When you are using the default engine, you do not have to specify the engine name in the LIBNAME statement. However, you do have to specify the libref and the SAS data library name.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

When you specify an engine for a library, what are you specifying?
a.
the file format for files that are stored in the library
b.
the version of SAS that you are using
c.
permission to access to other software vendors’ files
d.
instructions for creating temporary SAS files

A

Correct answer: a
A SAS engine is a set of internal instructions that SAS uses for writing to and reading from files in a SAS library. Each engine specifies the file format for files that are stored in the library, which in turn enables SAS to access files with a particular format. Some engines access SAS files, and other engines support access to other vendors’ files.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q
Which statement prints a summary of all the files stored in the library named Area51?
a.
proc contents data=area51._all_ nods;
b.
proc contents data=area51 _all_ nods;
c.
proc contents data=area51 _all_ noobs;
d.
proc contents data=area51 _all_.nods;
A

Correct answer: a
To print a summary of library contents with the CONTENTS procedure, use a period to append the ALL option to the libref. Adding the NODS option suppresses detailed information about the files.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
Which of the following programs correctly references a SAS data set named SalesAnalysis that is stored in a permanent SAS library?
a.
data saleslibrary.salesanalysis;
set mydata.quarter1sales;
if sales>100000;
run;
b.
data mysales.totals;
set sales_2017.salesanalysis;
if totalsales>50000;
run;
c.
proc print data=salesanalysis.quarter1;
var sales salesrep month;
run;
d.
proc freq data=2017data.salesanalysis;
tables quarter*sales;
run;
e.
none of the above
A

Correct answer: e
All the programs listed violate the rules for assigning a libref. Librefs must be 1 to 8 characters long, must begin with a letter or underscore, and can contain only numbers, letters, or underscores. After you assign a libref, you specify it as the first level in the two-level name for a SAS file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
What type of information does the CONTENTS procedure create?
a.
the contents of a library
b.
descriptor information for an individual SAS data set
c.
a and b only
d.
none of the above
A

Correct answer: c
The CONTENTS procedure creates a report that contains the contents of a library or the descriptor information for an individual SAS data set.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Assuming you are using SAS code, which one of the following statements is false?
a.
LIBNAME statements can be stored with a SAS program to reference the SAS library automatically when you submit the program.
b.
When you delete a libref, SAS no longer has access to the files in the library. However, the contents of the library still exist on your operating system.
c.
Librefs can last from one SAS session to another.
d.
You can access files that were created with other vendors’ software by submitting a LIBNAME statement

A

Correct answer: c
The LIBNAME statement is global, which means that librefs stay in effect until changed or canceled, or until the SAS session ends. Therefore, the LIBNAME statement assigns the libref for the current SAS session only. You must assign a libref before accessing SAS files that are stored in a permanent SAS data library.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does the following statement do?
libname states ‘c:\myfiles\sasdata\popstats’;
a.
defines a library called States using the Popstats engine
b.
defines a library called Popstats using the States engine
c.
defines the default library using the default engines
d.
defines a library called States using the default engine

A

Correct answer: d

The LIBNAME statement does not specify an engine. Therefore, it uses a default engine to create the States library.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly