To subset data in SAS using the data step, the where statement is used to specify the conditions that observations must meet to be included in the new data set. The correct syntax for subsetting the SASHELP.BASEBALL data set to include only players in the 'East' Division with 75 or more hits is as follows:
data bball;
set sashelp.baseball;
where Division = 'East' and nHits >= 75;
run;
This code, as shown in option D, uses the where statement with the correct logical operator and to ensure that both conditions must be true for a record to be included in the new dataset. Options A, B, and C either use incorrect syntax or logical operations that do not match the required conditions for the subset. Option A has an incorrect combination of conditions, B uses two where statements which is not valid syntax, and C incorrectly uses the or operator which would include players not in the 'East' Division or with fewer than 75 hits.
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit