Base SAS Interview Question and Answers

Base SAS Interview Question and Answers

SAS Online Training1. Name few SAS functions?

ANS: Scan, Substr, trim, Catx, Index, tranwrd, find, Sum.

2. How many data types are there in SAS?

ANS: Character, Numeric

3. What is the function of output statement?

ANS: To override the default way in which the DATA step writes observations to output, you can use an OUTPUT statement in the DATA step. Placing an explicit OUTPUT statement in a DATA step overrides the automatic output, so that observations are added to a data set only when the explicit OUTPUT statement is executed.

4. What is the function of tranwrd function?

ANS: TRANWRD function replaces or removes all occurrences of a pattern of characters within a character string.

5. What SAS statements would you code to read an external raw data file to a DATA step?

ANS: INFILE statement.

6. What is the function of Stop statement?

ANS: Stop statement causes SAS to stop processing the current data step immediately and resume processing statement after the end of current data step.

7. What is the difference between an informat and a format?

ANS: Informats read the data. Format is to write the data.

8. How do you read in the variables that you need?

ANS: Using Input statement with the column pointers

9. How would you code the criteria to restrict the output to be produced?

ANS: Use NOPRINT option.

10. How would you delete duplicate observations?

ANS: NONUPLICATES

11. What is the difference between reading the data from external file and reading the data from existing data set?

ANS: The main difference is that while reading an existing data set with the SET statement, SAS retains the values of the variables from one observation to the next.

12. What is the difference between SAS function and procedures?

ANS: Functions expects argument value to be supplied across an observation in a SAS data set and procedure expects one variable value per observation.

13. Which SAS statement does not perform automatic conversions in comparisons?

ANS: where statement

14. Explain Input and Put function?

ANS:  Input function – Character to numeric conversion- Input (source, informat)

Put function – Numeric to character conversion- put (source, format)

15. How many observations would be there at the end of data step execution?

ANS: 12

16. What is the purpose of the trailing @ and the @@? How would you use them?

ANS: @ holds the value past the data step.@@ holds the value till a input statement or end of the line.

Double trailing @@: When you have multiple observations per line of raw data, we should use double trailing signs (@@) at the end of the INPUT statement.

For Best SAS Online Training please visit http://www.revanthtechnologies.com