Multiple choice technology programming languages

Flat file structure is as below 1----5----10 $1,120 The following code is submitted. data temp; infile ‘file specification’; input salary 5; run; What would be the value of SALARY in the dataset TEMP

  1. blank value

  2. $1,120
  3. 2

  4. .

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

When reading with informat 5. (which reads up to 5 columns), SAS reads '$1,12' but stops at the comma because it's not a valid numeric character. The informat '5.' means read 5 columns or until a non-numeric character. Only '1' and '2' are read as valid digits, giving the value 2. The dollar sign and comma are ignored in standard numeric reading.

AI explanation

To answer this question, let's understand the code and its impact on the dataset.

The given code is reading data from a file specified in the "infile" statement and creating a dataset named "temp". The "input" statement is used to define the variables and their lengths to be read from the file. In this case, "salary" is defined with a length of 5.

Based on the given flat file structure, the value "1,120" is located at positions 1 to 5. Since "salary" is defined with a length of 5, it will read the value "1,120" from the file.

Therefore, the value of SALARY in the dataset TEMP would be 2.

So, the correct answer is Option C: 2.