216k views
2 votes
Which of the following SELECT groups correctly writes observations to the tropical data set based on values of Region?

a.
select region;
when (2,3,5) output tropical;
otherwise;
end;
b.
select;
when (region=2,3,5) output tropical;
otherwise;
end;
c.
select (region);
when (2,3,5) output tropical;
otherwise;
end;

1 Answer

4 votes

Final answer:

Option (b) is the correct syntax for writing observations to a dataset based on certain values of a region variable, assuming tropical regions are coded as 2, 3, and 5. This matches the conditional statement syntax used in SAS.

Step-by-step explanation:

The correct answer to the student's question about which SELECT group correctly writes observations to the tropical dataset based on values of Region is option (b): select; when (region=2,3,5) output tropical; otherwise;end;. This syntax specifies that when the region variable has the values 2, 3, or 5, the respective rows should be written to the tropical dataset.

To support this choice, there are two observations that we can consider:

  • It is assumed that the 'region' variable holds some kind of categorical geographical data where certain numeric codes such as 2, 3, and 5 represent regions classified as 'tropical'.
  • Programming languages that deal with data such as SQL or SAS have specific syntax for conditional statements; the given syntax closely matches the conditional output syntax used in SAS.

User KingFu
by
7.5k points