In the following SAS program, the input data files are sorted by the NAMES variable: libname temp 'SAS-data-library'; data temp.sales; merge temp.sales work.receipt; by names; run; Which one of the following results occurs when this program is submitted?

  1. The program executes successfully and a temporary SAS data set is created

  2. The program executes successfully and a permanent SAS data set is created

  3. The program fails execution because the same SAS data set is referenced for both read and write operations

  4. The program fails execution because the SAS data sets on the MERGE statement are in two different libraries


Correct Option: B

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) The program executes successfully and a temporary SAS data set is created - This option is incorrect. The program does create a SAS data set, but it is not temporary.

Option B) The program executes successfully and a permanent SAS data set is created - This option is correct. The program successfully merges the data sets and creates a permanent SAS data set named "sales" in the "temp" SAS data library.

Option C) The program fails execution because the same SAS data set is referenced for both read and write operations - This option is incorrect. The program merges two different data sets, "temp.sales" and "work.receipt", so there is no conflict in referencing the same data set.

Option D) The program fails execution because the SAS data sets on the MERGE statement are in two different libraries - This option is incorrect. The program merges data sets from two different libraries, but this is not an issue for the MERGE statement.

The correct answer is Option B. The program executes successfully and a permanent SAS data set is created because the data sets are merged based on the "names" variable.

Find more quizzes: