47.6k views
1 vote
Which assignment statement for Total correctly uses a SAS variable list and the SUM function to add the values for Year1, Year2, Year3, and Year4?

PDV
Year2 Year1 Year3 Year4 Sales
100 105 130 125 115
a. Total=sum(of Year1-Year4);
b. Total=sum(of Year2--Year4);
c. Total=sum(of Year:);
d. All of the above

User Dcharles
by
8.9k points

1 Answer

3 votes

Final answer:

The answer to which assignment statement correctly sums the years using SAS is 'd. All of the above', because all options correctly use the SUM function with a variable list to calculate the total.

Step-by-step explanation:

The student asks which assignment statement for Total correctly uses a SAS variable list and the SUM function to add the values for Year1, Year2, Year3, and Year4. The correct answer is d. All of the above. Here's why:

  • a. Total=sum(of Year1-Year4); This statement correctly uses the SUM function and a variable list to add Year1 through Year4.
  • b. Total=sum(of Year2--Year4); Although this appears to be a typo with an extra dash, in SAS, this is also a correct syntax that defines a variable list from Year2 to Year4. If the Year1 variable is not needed, this would correctly sum Year2, Year3, and Year4.
  • c. Total=sum(of Year:); This statement uses another form of variable list, the colon (:) operator, which indicates all variables that start with 'Year', summing Year1 to Year4.
User Moein Moeinnia
by
8.5k points