Multiple choice technology programming languages

data y; set x; length a $12; run; In the dataset x there is a variable called a which is numeric and of length 8.What is the result of this data step?

  1. No observations in dataset y

  2. variable a in dataset y will be numeric and of length 8

  3. variable a in dataset y will be character and of length 12

  4. Error since the variable a is defined as both character and numeric

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

This data step attempts to define variable 'a' as both numeric (from dataset x) and character (LENGTH \$12 statement). SAS cannot process this because a variable cannot have conflicting types in the same data step. The LENGTH statement with $ creates a conflict with the existing numeric variable, causing an error.