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;

No comments:

Post a Comment