Flat file structure is as below (Very good question) 1----5----10 vital reddy 45 vijay 30 sarma 40 The following code is submitted. data temp; infile ‘file specification’; input x $ age; if age<=40; run; How many observations will be there in the TEMP dataset?

  1. 3

  2. 2

  3. 0 observations

  4. syntax error


Correct Option: A

AI Explanation

To answer this question, let's go through the given code step by step:

The code reads data from a file using the INFILE statement and stores it in the TEMP dataset.

The INPUT statement is used to specify the variables to be read from the file. In this case, it reads the variable 'x' as a character variable and 'age' as a numeric variable.

The IF statement is used to filter the observations based on the condition 'age<=40'. It only keeps the observations where the age is less than or equal to 40.

Given the flat file structure, the observations with the following ages meet the condition:

  • vital reddy (age 45) does not meet the condition
  • vijay (age 30) meets the condition
  • sarma (age 40) meets the condition

Therefore, there will be a total of 2 observations in the TEMP dataset that meet the condition.

So, the correct answer is B) 2 observations.

Find more quizzes: