data temp; set lib1.x lib2.y; length jobcode $12.; run; What would be the length of Jobcode in temp?

  1. 5

  2. 12

  3. 8

  4. Syntax error


Correct Option: B
Explanation:

To solve this question, the user needs to know the basics of SAS programming and the SET statement.

The SET statement merges two or more SAS data sets into a single data set. The resulting data set inherits the attributes of the first data set in the SET statement. In this case, the first data set is lib1.x, which contains a variable called Jobcode with a length of 12. Therefore, the resulting data set temp will also have a variable called Jobcode with a length of 12.

Now, let's go through each option and explain why it is right or wrong:

A. 5: This option is incorrect. The length of Jobcode was defined as 12 in the first data set in the SET statement, so it will be 12 in the resulting data set regardless of the length of Jobcode in the second data set.

B. 12: This option is correct. The length of the Jobcode variable is defined as 12 in the first data set in the SET statement. Since the resulting data set inherits the attributes of the first data set, the length of Jobcode in temp will also be 12.

C. 8: This option is incorrect. The length of the variable Jobcode was defined as 12 in the first data set in the SET statement, so it will be 12 in the resulting data set regardless of the length of Jobcode in the second data set.

D. Syntax error: This option is incorrect. There is no syntax error in the given code.

Therefore, the correct answer is:

The Answer is: B. 12

Find more quizzes: