A00-211 Exam QuestionsBrowse all questions from this exam

A00-211 Exam - Question 14


The following SAS program is submitted:

data test;

set chemists;

jobcode = Chem2

then description = Senior Chemist;

else description = Unknown;

run;

The value for the variable JOBCODE is:

JOBCODE -

-------------

chem2

What is the value of the variable DESCRIPTION?

Show Answer
Correct Answer: B

Given the SAS program, the value for the variable JOBCODE is 'chem2' in lowercase. However, the code checks if jobcode is equal to 'Chem2' with an uppercase 'C'. Since 'chem2' does not match 'Chem2' (because SAS is case-sensitive), the condition fails, and the ELSE part of the statement is executed, assigning the value 'Unknown' to the variable DESCRIPTION.

Discussion

4 comments
Sign in to comment
mhminkovOption: C
Jun 5, 2021

there is also a missing if statement, here the corrected code: data test; infile datalines; if jobcode = "Chem2" then description = "Senior Chemist"; else description = "Unknown"; input JOBCODE $; datalines; chem2 ;

Kleinstone
Jan 17, 2021

with quotation mark?

Misty2287
Aug 4, 2023

why are so many code have typos and incorrect syntax. So frustrating and confusing to go through practices this way.

Lisa_LOption: B
Dec 6, 2023

Unknown is the answer. JOBCODE is chem2 (lowercase). In the IF statement: if jobcode = 'Chem2' then description = 'Senior Chemist';, C is in capital case. Since the condition does not meet, the ELSE statement would be executed.