Premium

SAS Base Latest Interview Preparation (Q&A)



Question-: Can you please elaborate all thee items created in the compile phase and what is the use of them?

Answer: These all three things are container for the various data and would be used during the execution phase. Let’s discuss each of them
- Input buffer: Whenever SAS reads a record from the RAW data (during execution phase) it first place it into the input buffer. Input buffer is a logical area in memory (RAM). Input buffer at a time has only one record from raw file.
- Program data vector: This is also a logical area in the memory but SAS uses it to create a Data set. First raw data one record is read from a raw file and added in the input buffer as a next step it assigns variables to each data value and write entire single observation in the program data vector. Program data vector at a time keep only one observation.
In addition to the observation, program data vector also has two automatic variable created which are _N_ and _ERROR_
- Descriptor information: This holds the information about the entire dataset like all the variables information, how many observations in the data set etc.



Question-: What is the SAS automatic variable?

Answer: During the Data step SAS creates a program data vector which can hold actual observation as well as two automatic variables named _N_ and _ERROR_
Where
- _N_: holds how many times data step is iterated.
- _ERROR_: During the execution phase if there are any error happened or not.
Both the automatic variable can only be populated during the execution phase.



Question-: What is the execution phase?

Answer: During the compilation phase only machine instructions and logical memory (input buffer, program data vector) would be created but they would not be executed. Machine instructions would be executed during the execution phase only. Suppose your raw file has 1000 records then your data step would be compiled only once but executed 1000 times, once for each record.



Question-: What would happen during the execution phase of the data step?

Answer: During the execution phase of data step following things would be done in each iteration
- SAS reads raw record in input buffer.
- Assign values from record in the program vector and in the specific variable.
- If you are creating a new variable in the program by applying some calculation then this would also be created in the program data vector.
- Once all the records iteration is done then following 3 things would be done at the end of each execution step
o Dumping the program data vector (one observation) in the SAS data set
o Program go back to the next record and start from the Data step again.
o Variable in the program data vector are specified or reset to missing values.
- Following two things would not be reset in each iteration
o Automatic variable _N_ and _ERROR_
o If you have specified any variable with the RETAIN statement
- Once all the records are processed and SAS data set would be closed for further write, and SAS goes to next DATA or PROC step, if specified as next.

Related Questions


Question-: How can you crate a permanent dataset in SAS?

Question-: Can a numeric variable below to the ‘character’ data type?

Question-: Can you explain the PROC contents and PROC print procedure?

Question-: What all are the basic categories in which you can divide the SAS procedures?

Question-: How do you specify the input dataset for a procedure?

Question-: What do you mean by threaded processing of SAS Base procedure?

Question-: Why ODS was introduced and what is the use of it?

Question-: What is the use of QUIT statement?