Pages

Wednesday, February 26, 2014

Widgets

SAS Interview questions and answers Part 1

Do you have scheduled interview and want to know about the general questions asked in the SAS interview?
Here are some of the general questions asked in an interview with their answers.


When would you use select instead of IF statement?
A: 
Select is used over IF statement when you are using a condition to compare with several other conditions: Here is an example:

Data exam;
Set exam;
select (pass);
when Physics >60;
when math > 100;
when English = 50;
otherwise fail;
run;

What is the one statement to set the criteria of data that can be coded in any step?


A) Options statement.


What does ERRORS = 1 do in the OPTIONS statement?
A)
If there an error in the data for a observation then ERROR variable will have a value of 1 else 0


Is there any difference between VAR A1 - A4 and VAR A1 -- A4?

A) No, there is no diff between VAR A1-A4 and VAR A1—A4. You can use single (-) or double (--) but if you use more than 2 (---) then it will thrown an error.

Have you seen the error message ""numeric values have been converted to character"? What does it mean?

A) 
It means SAS has automatically converted the numeric variable to character to perform the functions.

Why is a STOP statement needed for the POINT= option on a SET statement?


A) Because POINT= reads only the specified observations, SAS cannot detect an end-of-file condition as it would if the file were being read sequentially.


Can you control the number of observations read in by SAS?
A) Yes, by using FIRSTOBS and OBS option

Approximately what date is represented by the SAS date value of 730?
A) 31st December 1961

Does SAS 'Translate' (compile) or does it 'Interpret'? Explain.
A) Compile

What does the RUN statement do?
A)
SAS editor will start compiling the data or proc step as soon as it encounters the run statement. SO if there are more than one data steps or a proc step followed by a data step then you can avoid using the run statement.

1 comment:

  1. Be carefull with the answer to the question regarding is there a difference between a1-a4 vs a1--a4 is NOT quite correct!! If variables were created positionally in your dataset for example a1 a2 a3 x1 a4 then the code a1 -- a4 would include the x1 too! SAS see the double dash as give me everything that was positionally between a1 and a4. So if you just want a1 a2 a3 a4 use the single dash a1-a4. Use proc contents to see the positional numbers. Try this: proc contents data=mydata position; run; Cheers!!!

    ReplyDelete