6.2k views
1 vote
If the value of Region is missing (.), do these two DATA steps produce the same output?

data temperate tropical;
set flora;
select (region);
when (1,4) output temperate;
when (2,3,5) output tropical;
otherwise;
end;
run;

data temperate tropical;
set flora;
if Region in (1,4)
then output temperate;
else if Region in (2,3,5)
then output tropical;
else output;
run;
a. Yes
b. No

User Atriace
by
8.7k points

1 Answer

2 votes

Final answer:

No, the two SAS DATA steps do not produce the same output for missing Region values because the SELECT-WHEN construct and the IF-ELSE statements handle missing values differently.

Step-by-step explanation:

The student is asking whether two SAS DATA steps produce the same output when the value of Region is missing. In the context of SAS, a missing value is represented by a period (.). The SELECT-WHEN construct and the IF-ELSE statements may handle missing values differently.

In the first DATA step, the SELECT-WHEN construct doesn't specify a condition for missing values, which will result in the otherwise condition executing for missing values. In contrast, the second DATA step uses IF-ELSE statements without an else condition for missing values, which means that rows with missing Region values will not be output to either temperate or tropical datasets.

Therefore, the answer is No, the two DATA steps do not produce the same output when the value of Region is missing.

User Endre Olah
by
8.5k points