Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

SAS Exam A00-215 Topic 12 Question 49 Discussion

Actual exam question for SAS's A00-215 exam
Question #: 49
Topic #: 12
[All A00-215 Questions]

The data set SASHELP. CARS contains information on different vehicles. How do you correctly write the observations with Type of 'SUV' to the suv data set and Type

of 'Sedan' to the sedans data set?

Show Suggested Answer Hide Answer
Suggested Answer: B

The correct syntax for creating two separate data sets based on a condition in SAS involves using a single DATA step with multiple data set names followed by a SET statement and conditional OUTPUT statements. Here's a breakdown of why option B is the correct answer:

data SUV Sedans;

set sashelp.cars;

if Type = 'SUV' then output SUV;

else if Type = 'Sedan' then output Sedans;

run;

This option correctly uses a single DATA step to declare two data sets (SUV and Sedans). It reads from the sashelp.cars data set and uses conditional statements to output observations to the respective data sets based on the value of the Type variable. The output statement is used to explicitly direct observations to the specified data set.

Option A: The syntax data=SUV data=Sedans; is incorrect. The correct syntax to create multiple data sets in a DATA step does not include equal signs (=).

Option C: The syntax within the conditional statements is incorrect (if Type = SUV and if Type = Sedan). The values for Type should be enclosed in quotes to specify that they are strings.

Option D: The syntax data= (SUV Sedans) ; is incorrect. The correct method to declare multiple data sets in a DATA step does not use parentheses or an equal sign.

Reference: The correctness of option B is based on standard SAS programming practices for conditional data manipulation within a DATA step. This approach is commonly documented in SAS programming resources such as the SAS 9.4 documentation and various SAS programming guides. The use of the output statement for directing data to specific datasets based on conditions is a fundamental technique in efficient data handling in SAS.


Contribute your Thoughts:

Gladys
6 hours ago
I was leaning towards Option A, but Option B seems more concise and easier to read.
upvoted 0 times
...
Tammara
1 days ago
Option B looks good to me. It's clear and straightforward.
upvoted 0 times
...
Gianna
4 days ago
I think the correct answer is A.
upvoted 0 times
...

Save Cancel