Commonly Asked SAS Interview Questions with Answer : 11 -15

Ques 11 : What is Format and Informat in SAS ?

Ans : In a simple word, when we are writing or printing the data from the SAS, we use Format to read the data as required and when we write the data to the SAS, we can use Informat to read the data by the SAS as required.
My favourite one liner : Informats are to read the data by SAS and Formats are to write the data by SAS.




Ques 12 : What is the type of variable in SAS ?

Ans : A Variable type is either character or numeric in SAS and each variable has a name that conforms to SAS naming conventions.



Ques 13 : How we could get the Descriptor information of an individual SAS dataset ?

Ans : We can use PROC CONTENTS (Procedure) to create SAS output which would describe the contents of the library and descriptor information of an individual SAS dataset.

Syntax : PROC CONTENTS DATA = Libref._ALL_ NODS ;                                  Run;



Quest 14 : If we use "Contents" Statement with PROC DATASETS, then what could be the result ?

Ans : The result would be same as Proc Contents (Procedure).
PROC DATASETS with Contents Statement is to view the contents of a SAS library or the descriptor information of a dataset.

Syntax :  PROC DATASETS;
                Contents Data = Libref._All_ Nodetails; 
                Quit ;



Ques 15 : How can we copy an entire SAS Library to other location ?

Ans : With the help of PROC DATASETS we can copy an entire SAS Library to other location.

Syntax :      Proc Datasets Library = Source;
                    Copy Out = Destination;
                    Quit;

Commonly Asked SAS Interview Questions with Answer : 6 - 10

Ques 6 : What are the Automatic Variables in SAS ?

Ans : Automatic variables are automatically created by Data Step in SAS. There are two default automatic variable in SAS :
            1. _N_                          2. _ERROR_

_N_ : It represents the number of times of Data Step iteration. It is initially set to 1 and increases by 1 for each complete iteration of data step.

_ERROR_ : It is initially set to 0. Whenever any error come across in SAS code or data step, it increases by 1.



Ques 7 : Are Automatic Variables added to PDV ?

Ans : Yes, Automatic Variables are added to PDV but these are not a part of output data set being created.



Ques 8 : How many ERRORs SAS prints by default ?

Ans : 20 Errors at a time.



Ques 9 : How many data types are there in SAS ?

Ans : There are only two type of data type for variable in SAS :
             1. Character              2. Numeric
Note : SAS date values are in Integer



Ques 10 : What is SAS Date and what is the use of it ?

Ans : SAS Date is " 01 January 1960". It helps to calculate the given date.  SAS keeps dates as integer and values would be equal to the number of days from 01 January 1960.

Commonly Asked SAS Interview Questions with Answer : 1 - 5

Ques 1 : What is SAS ?

Ans : SAS is a combined system for software solution which provide us the facility to retrieve the data, input the data, data management for writing the reports as well as for graphic design, statistical analysis and mathematical analysis.

In a common word we can say that " SAS is a integration of modules which are used to create, analyse and process the data." 

Originally it was only to use for statistical calculation and for creating reports but now it is in every field with specific tool.


Ques 2 :  What is PDV ?

Ans : PDV stands for Program Data Vector. In a general term "whenever SAS creates a new dataset, The information about each of the variable is stored in a reserved area of memory known as PDV." Here SAS creates a virtual dataset which keeps one observation at a time.


Ques 3 : What is Input Buffer ?

Ans : Input buffer is also a memory where SAS puts each record of data line by line if it is read by input file. Input buffer is created during the compile stage of data to hold the record from external file.


Note :  If input file is a SAS dataset, then SAS does not create an input buffer, it writes the data directly to the PDV.


Ques 4 : What are the stages in data step to process the data in SAS ?

Ans : SAS processes DATA Step in two stages :
                1. Compile Stage
                2. Execution Stage


Ques 5 : What is Descriptor and Data portion in SAS ?

Ans :  During the compile stage of data step, SAS conclude whether variable is character or numeric and defines the storage length of each variable. This facility or information is called as Descriptor Portion of data set. 
In a single line " Descriptor portion of a SAS dataset contains the information about the dataset".

The Data Portion of a sas dataset is a collection of data values which are positioned in a rectangular table.