data work.passengers; if origpassengers=. then origpassengers = 100; transpassengers=100; origpassengers=.; nonpaying=10; totalpassengers = origpassengers + Transpassengers; run; which one of the following is the value of the totalpassengers variable in the output data set?

  1. 100

  2. 110

  3. 200

  4. missing


Correct Option: D

AI Explanation

To determine the value of the totalpassengers variable in the output data set, let's go through each step of the SAS code provided:

  1. data work.passengers;: This line of code creates a new SAS data set named passengers in the work library.

  2. if origpassengers=. then origpassengers = 100;: This line of code checks if the origpassengers variable is missing (.). If it is missing, it assigns a value of 100 to origpassengers. However, since origpassengers is not explicitly defined in the code, it is assumed to be missing.

  3. transpassengers=100;: This line of code assigns a value of 100 to the transpassengers variable.

  4. origpassengers=.;: This line of code assigns a missing value to the origpassengers variable. This line is executed after step 2, so the value assigned in step 2 is overwritten by the missing value.

  5. nonpaying=10;: This line of code assigns a value of 10 to the nonpaying variable.

  6. totalpassengers = origpassengers + Transpassengers;: This line of code calculates the sum of the origpassengers and transpassengers variables and assigns the result to the totalpassengers variable. Since both origpassengers and transpassengers are missing, the sum will also be missing.

  7. run;: This line of code signals the end of the data step.

Therefore, the value of the totalpassengers variable in the output data set is missing (Option D).

Find more quizzes: