Which SAS program creates a variable named City with a value of Chicago correctly?

Master the SAS Base Programming Certification Exam with our comprehensive study tool. Utilize flashcards and multiple choice questions with detailed explanations. Gear up for success on your exam!

The correct choice effectively creates a variable named City with the intended value of 'Chicago' under the specified condition. In this option, the program begins by defining a data step (DATA work.airport) and assigns the value 'ORD' to the variable AirportCode.

The conditional statement, "IF AirportCode='ORD'", checks whether the value of AirportCode is indeed 'ORD'. When this condition is true, the then-clause executes, assigning the string 'Chicago' to the variable City. The use of single quotes around 'Chicago' is crucial, as it denotes that 'Chicago' is a character string. This program thus results in a City variable that holds the value 'Chicago' when the condition is met.

The program ends with the RUN statement, which indicates the conclusion of the data step, finalizing the creation of the new variable. Since all the syntactical components are correctly in place, the program functions as intended, producing the required variable and value.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy