Commonly Asked SAS Interview Questions with Answer : 66 - 70

Ques 66 : Is it possible that we could sandwich INSERT and DELETE or any other statements in between PROC SQL and QUIT statement ?

Ans : Yes, We could sandwich INSERT and DELETE or any other statements in between PROC SQL and Quit statement.

Syntax :
PROC SQL;
DELETE from DSN
WHERE Id="2458";
INSERT into DSN
Select * from Uma.DSN
WHERE ID="2458";
QUIT; 



Ques 67 : How many tables can we join in a single INNER JOIN in PROC SQL and what could be the maximum length of a macro variable ?

Ans : 32

  • We can combine a maximum of 32 tables in a single INNER Join
  • Maximum length for macro variable is 32 character



Ques 68 : What is the difference between INPUT Statement and INPUT Function in SAS?

Ans : The INPUT Statement is used to define the variables while INPUT Function converts character values to numeric values (by using informat).



Ques 69 : How to get the defined range of observations from a SAS Dataset ?

Ans : To get the observation of a define range from a SAS Dataset, we can use SAS dataset options FIRSTOBS= and OBS=.

Suppose we have a dataset with 100 observations but we just want to print observation from 50 to 55 then we need to specify FIRSTOBS and OBS dataset options.



  • FIRSTOBS= : Specifies the starting point of desired range
  • OBS= : Specifies the ending point of desired range


 

Ques 70 : What is the use of Single dash (-) and Double dash (--) in between variables in SAS like Var V1-V4 and Var V1--V4 ?

Ans : When variables of a SAS dataset are in successive naming convention with same prefix and we want to get all or few of them, we can use single dash (-) or double dash (--) to select the variables.

Single Dash (-) : When variables names are in same prefix with successive suffix of number, we can use single dash to specify the entire range of variables. It would exclude all other variables which don't have same prefix.

Double Dash (--) : When we want to get a list of variables from a dataset in order in which they are specified in dataset, we can use double dash (--). It would include all other variables which don't have same prefix as well.



No comments:

Post a Comment