0
votes

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_99.salesanalysis;
if totalsales>50000;
run;

C)
proc print data=salesanalysis.quarter1;
var sales salesrep month;
run;

D)
proc freq data=1999data.salesanalysis; 
tables quarter*sales;
run;

My answer is (a. data saleslibrary.salesanalysis) but the solutions says Correct answer: (b. set mydata.quarter1sales),the explaination goes : "Librefs must be 1 to 8 characters long, must begin with a letter or underscore, and can contain only letters, numbers, or underscores. After you assign a libref, you specify it as the first element in the two-level name for a SAS file."

However the question asks for SalesAnalysis, so is the solution wrong? I am wondering if "saleslibrary.salesanalysis" is the original library + file name and "mydata.quarter1sales" is the library name +file name for output data?

2
Format your code in the future - Reeza
Why are you editing your question to delete it? If you do so, there's no reason to answer any of your future questions. Although we answer questions to help you the goal is also to create a reference for future users. Deleting or editing questions after the fact is inconsiderate. - Reeza

2 Answers

1
votes

The correct answer is B.

  • A -> the libname reference is too long, it can only be 8 characters.
  • B -> Does refer to the data set in question.
  • C -> Again, not referring to salesAnalysis as a data set but a library
  • D -> Library name is incorrect, it cannot start with a number.

The format to reference a SAS data set is

 LIBNAME.dataSetName;

Where libname follows the rules in the question and data set name rules are also correctly applied.

0
votes

Key word is "referencing"...not "creating". Assuming your studying for the BASE 9 exam...and you have a bootleg study guide.

Referencing the original formatted data provided before the edit, the answer is in fact b., because the real answer b. reads set sales_99.salesanalysis;, its just marked as "f." in the study guide you are using. This makes sense because you can assume your answers (a.-n. as presented) can be broken down into 4 very obvious data steps.

the key word data will create a data set, the key word set will reference one