What happens when you submit the code shown below? data table1 table2; set sashelp.shoes; output; run;
Correct Answer: B
In SAS, the code you provided involves creating two datasets, table1 and table2, from the dataset sashelp.shoes. The key part to understand here is how the DATA statement and OUTPUT statement interact with the specified datasets. * DATA Statement: The statement data table1 table2; initiates the creation of two new datasets named table1 and table2. * SET Statement: The set sashelp.shoes; statement is used to read data from the sashelp.shoes dataset. This dataset includes data on shoe sales from SASHELP library, which is commonly used for demonstration purposes in SAS. * OUTPUT Statement: In the context of the DATA step where multiple datasets are specified in the DATA statement (as in table1 table2), the OUTPUT statement without a dataset name specified outputs the current observation to all datasets listed in the DATA statement. This is a critical point because it determines where the data goes after processing in the DATA step. * Execution: When the run; statement is executed, it processes each observation from sashelp.shoes. For each observation, because there is no condition or additional OUTPUT statements specifying dataset names, each observation is output to both table1 and table2. Therefore, the correct behavior as described is that each observation in sashelp.shoes is written to both table1 and table2. This effectively duplicates each row from the source into both target datasets. References: * SAS 9.4 Language Reference: Concepts, "DATA Step Processing" and "OUTPUT Statement" sections provide detailed explanations on how DATA steps process and how OUTPUT statement works in different contexts. * Practical examples and explanations from SAS programming courses and official SAS documentation, which discuss DATA and SET statements, and their interaction with OUTPUT in data duplication scenarios.
A00-215 Exam Question 27
Which two data sets are permanent?
Correct Answer: B,D
In SAS, datasets can be either temporary or permanent, depending on the library where they are stored. Temporary datasets are stored in the Work library and are deleted at the end of the session, while permanent datasets reside in user-defined libraries or in libraries that refer to a more persistent storage location. For this question: * B. Mylib.new: This is a permanent dataset. The prefix 'Mylib' suggests it is stored in a user-defined library (not the temporary 'Work' library), implying that the data persists beyond the current session unless explicitly deleted or if the library's link to the storage location is removed. * D. Temp.new: Despite the potentially misleading name 'Temp', if this dataset is not explicitly stored in the Work library, it could indeed be permanent. The permanence of a dataset is determined by its library reference, not by its name. If 'Temp' is a user-defined library linked to a persistent storage, then 'Temp.new' is also permanent. C: Work.new: This dataset is explicitly temporary as it is stored in the Work library, which is cleared at the end of the SAS session. A: New: Without additional context about the library, 'New' does not provide enough information to determine its permanence. It could be either temporary or permanent depending on the library it references. References:SAS documentation on libraries and dataset management, SAS Institute.
A00-215 Exam Question 28
Given the following code: Which variables are created with the BY statement?
Correct Answer: A
In SAS, when you use a BY statement in a DATA step, SAS creates two temporary variables for each variable listed in the BY statement: one to indicate the first occurrence (FIRST.variable) and another to indicate the last occurrence (LAST.variable) of the value within the BY-group. Given the provided code and assuming that State is the variable used in the BY statement, SAS will create First.State and Last.State. Thus, option A is correct. References: * SAS documentation on the BY statement, SAS Institute.