A00-231 practice question 4 of 10

Assume that Sasuser.One does not exist and that the following SAS program is submitted at the beginning of a new SAS session: data sasuser.one; x=1; y=27; output one; run; Select one:

Full set: 36 questions
Answer options
A: The data set Sasuser.One is created with 2 variables and 3 observations.
B: The data set Sasuser.One is created with 2 variables and 0 observations.
C: The data set Work.One is created with 2 variables and 1 observation.
D: The data set Sasuser.One is created with 2 variables and 1 observation. Correct answer
Correct Answer:
D. The data set Sasuser.One is created with 2 variables and 1 observation.
Explanation

The DATA step begins by defining a new data set named one to be stored in the sasuser library. The assignment statements x=1; and y=27; create two numeric variables and place their values into the Program Data Vector (PDV). The output one; statement explicitly instructs SAS to write the current contents of the PDV to the output data set. It is valid to refer to the output data set sasuser.one by its member name (one) in the OUTPUT statement. Because the DATA step does not read from an external source or contain an explicit loop, it executes only once. Therefore, a single observation is written, and the resulting data set Sasuser.One contains 2 variables and 1 observation.

Why Incorrect

A. The DATA step executes only once because there is no input file, SET statement, or explicit loop to cause multiple iterations. Thus, only one observation is created.
B. This would be correct only if the output one; statement caused an error, which would create an empty data set. However, this syntax is valid, and an observation is successfully written.
C. The DATA statement explicitly specifies the sasuser library (data sasuser.one;), so the data set is created in the Sasuser library, not the default Work library.

References

1. SAS Institute Inc. (2013). SAS Certified Professional Prep Guide: Base Programming for SAS 9. SAS Institute. p. 104.

In Chapter 4, "Creating SAS Data Sets," the section "Directing Output to Multiple SAS Data Sets" states: "When you list more than one data set in the DATA statement, you must use an OUTPUT statement to explicitly direct output to one or more of the data sets. In the OUTPUT statement, you can specify the data set by using a one-level or two-level name." This confirms that using one to refer to sasuser.one is valid syntax.

2. SAS 9.4 Language Reference: Concepts, Sixth Edition. "The DATA Step," "DATA Step Processing."

This reference details the two phases of DATA step processing: compilation and execution. During compilation, the descriptor for sasuser.one is created. During the single execution pass, the OUTPUT statement writes one record to the data set before the step terminates.

3. UCLA: Institute for Digital Research and Education. SAS Learning Module: The DATA Step.

The module provides examples of directing output to multiple data sets, consistently using the one-level member name in the OUTPUT statement even when the DATA statement might imply a permanent library. For instance: data hs0m hs0f; set "c:\sasdata\hs0"; if female = 1 then output hs0f; else output hs0m; run;. This demonstrates the common and valid practice of using member names.

Scroll to Top