Commonly Asked SAS Interview Questions with Answer : 56 - 60

Ques 56 : What is the use of MEANS Procedure in SAS and what are the defaults statistics for it ?

Ans : The MEANS Procedure (PROC MEANS) is to get summarized data by computing descriptive statistics for numeric variables on across all observations.

PROC MEANS produced five statistics by default which are given below :
1. N (Number of non-missing values)
2. MEAN
3. STD DEV (Standard Deviation)
4. MINIMUM
5. MAXIMUM



Ques 57 : What are the basic difference between PROC MEANS and PROC SUMMARY in SAS ?

Ans : PROC MEANS with NOPRINT option is just like as PROC SUMMARY.

The basic difference between both is : By default, PROC SUMMARY creates an output dataset while PROC MEANS produces a printed output.



Ques 58 : What are the NULL data sets and DEFAULT data sets in SAS ?

Ans : There are three types of special SAS Data Sets in SAS :
1. Null Data sets : _NULL_

2. Default Data sets : _LAST_

3. Automatic naming convention Data sets : DATAn

* for DATAn, Kindly refer : Question 17



Ques 59 : What is the use of PUT and INPUT function in SAS ?

Ans : PUT Function : It converts numeric values to character values and it requires FORMAT.

INPUT Function : It converts character values to numeric values and it requires INFORMAT.


Proc contents output of Data set R:



Ques 60 : How can we count the number of missing values of numeric variable in a SAS data set ?

Ans : To count the number of missing values for numeric variable, We could use MEANS Procedure with NMISS option.


PROC MEANS DATA=DSN NMISS;
VAR NUMV;
RUN;

Commonly Asked SAS Interview Questions with Answer : 51 - 55

Ques 51 : How could we create an empty table which should have all the attributes of an existing table ?

Ans : By using LIKE clause in PROC SQL, we can create an empty table which would have all the attributes of an existing table.

PROC SQL;
CREATE TABLE DSN1
LIKE DSN;
QUIT;

* DSN1 and DSN are tables



Ques 52 : While using SQL Procedure in SAS, What is the difference between 'SET' clause and 'VALUE' clause ?

Ans : For SQL Procedure in SAS, we use 'SET' clause and 'VALUE' Clause to insert the rows / value into the table.

By using SET clause we can assign values to column by name irrespective of column position while VALUE clause assigns values to column by column position.

* For SET clause, if we don't specify the data for a column then value of that column would be a missing value

* For VALUE clause, if we don't specify the data for a column then there would be an error : Row is not inserted



Ques 53 : What is 'TRANS_RC' and 'JOB_RC' in SAS DI Studio ?

Ans : TRANS_RC and JOB_RC are job's status handling macro variables. 
we can set &Trans_rc and &Job_rc macro variables with respect to the return code value of completed transformation and individual steps within a transformation respectively in SAS DI Studio.



Ques 54 : What is the difference between '%STR' and '%BQUOTE' SAS macro functions ?

Ans : %STR and %BQUOTE macro functions are for masking the special characters and Mnemonics. 

We can use %STR macro function is specifically for unmatched quotation marks and parentheses while we use %BQUOTE macro function for matched quotation marks and parentheses.

Macro function %STR is a compilation function while %BQUOTE is execution function.



Ques 55 :  What is the difference between '%EVAL' and '%SYSEVALF' SAS macro functions ?

Ans : SAS Macro functions %EVAL and %SYSEVALF are to evaluate the arithmetic expression.

%EVAL function supports only integer arithmetic expressions while %SYSEVALF function supports floating point values for arithmetic expressions.

Example:
%LET A=%EVAL(10+5);

%LET B=%SYSEVALF(10.5+ 5.5);

%Put The value of A is &A and the value of B is &B;

Commonly Asked SAS Interview Questions with Answer : 45 - 50

Ques 45 : What is the difference between INTCK and INTNX function in SAS ?

Ans : In SAS, INTCK function calculates the number of interval between to dates while INTNX function calculates the date of a given number of intervals.

Suppose today is '01JAN2015' then by INTCK we can calculate that there are '364' days in between today and '31DEC2015'.

While if we want to get the date just after '364' days from today (01JAN2015) then by INTNX the result would be '31DEC2015'.

DATA DSN;
FORMAT INTNX1 date9.;
INTCK1=INTCK('Days','01JAN2015'd,'31DEC2015'd);
INTNX1=INTNX('Days','01jan2015'd,364);
Run;



Ques 46 : Which SAS Statement is more useful or efficient : WHERE or IF ?

Ans : WHERE statement is more useful in SAS in comparison to IF statement. We can use WHERE statement in Data Step as well as with SAS Procedures but we can not use IF statement in SAS Procedures.
There are several useful operators, we can use with WHERE statement given as : 'LIKE', 'CONTAINS', 'IS NULL', 'IS MISSING', 'BETWEEN AND' and so on...

* If we use more than one 'WHERE' statements condition on same variable in a same data step or proc step, then last WHERE statement will overwrite on all previous ones

* If we use more than one 'IF' statements condition on same variable in a same data step, then there would be no execution but it could get execute by using 'OR' or 'AND'

* We can not use any automatic variables created by data step (FirstDot, LastDot ,_N_ , _ERROR_) in a 'WHERE' expression



Ques 47 : What is the SAS valid date range and what would happen if someone passes the date which is outside of SAS date range ?

Ans : We are familiar with a date '01JAN1960' which is just to perform calculation on dates into SAS.

SAS dates are valid from '01JAN1582' AD to '31DEC20000' AD. 
If we pass any date prior or after of valid dates then values would get truncated.



Ques 48 : What are the various methods to combine SAS data sets ?

Ans : There are several ways to combine SAS datasets. Some methods are given below :
(A) Concatenate (B) Interleave (C) Merge (D) Update (E) Modify



Ques 49 : What would happen if we use same variable for DROP and KEEP statement in SAS ?

Ans : If same variable is specified in both 'DROP=' and 'KEEP=' statement then variable would get dropped.



Ques 50 : While concatenation of SAS dataset, which method is faster than other : PROC APPEND or SET Statement ?

Ans : SAS Procedure PROC APPEND concatenates much faster than the SET Statement because Proc Append does not process the observations from the base data set.

* We can use any number of datasets with SET statement but for PROC APPEND we can use only two datasets

* We can specified upto 50 SAS datasets in a single SET statement