SAS Interview Questions and Answers
by Nithyanandham, on Sep 11, 2022 6:11:00 PM
Q1. Explain what is SAS? What are the functions does it performs?
Ans: SAS means Statistical Analysis System, which is an integrated set of software products.
- Information retrieval and data management
- Writing reports and graphics
- Statistical analysis, econometrics and data mining
- Business planning, forecasting and decision support
- Operation research and Project management
- Quality Improvement
- Data Warehousing
- Application Development
Q2. Explain what is the basic structure of SAS programing?
Ans: The basic structure of SAS are
- Program Editor
- Explorer Window
- Log Window
Q3. What is the basic syntax style in SAS?
Ans: To run program successfully, and you have following basic elements:
- There should be a semi-colon at the end of every line
- A data statement that defines your data set
- Input statement
- There should be at least one space between each word or statement
- A run statement
For example: Infile ‘H: \StatHW\yourfilename.dat’;
Q4. Explain what is Data Step?
Ans: The Data step creates an SAS dataset which carries the data along with a “data dictionary.” The data dictionary holds the information about the variables and their properties.
Q5. Explain what is PDV?
Ans: The logical area in the memory is represented by PDV or Program Data Vector. At the time, SAS creates a database of one observation at a time. An input buffer is created at the time of compilation which holds a record from an external file. The PDV is created following the input buffer creation
Q6. Mention what are the data types does SAS contain?
Ans: The data types in SAS are Numeric and Character.
Q7. In SAS explain which statement does not perform automatic conversions in comparisons?
Ans: In SAS, the “where” statement does not perform automatic conversions in comparisons.
Q8. Explain how you can debug and test your SAS program?
Ans: You can debug and test your SAS program by using Obs=0 and systems options to trace the program execution in log
Q9. Mention what is the difference between nodupkey and nodup options?
Ans: The difference between the NODUP and NODUPKEY is that, NODUP compares all the variables in our dataset while NODUPKEY compares just the BY variables
Q10. Mention the validation tools used in SAS?
Ans: For DataSet : Data set name/ debug Data set: Name/stmtchk
For Macros: Options: mprint mlogic symbolgen
Q11. Explain what does PROC print, and PROC contents are used for?
Ans: To display the contents of the SAS dataset PROC print is used and also to assure that the data were read into SAS correctly. While, PROC CONTENTS display information about an SAS dataset.
Q12. Explain what is the use of function Proc summary?
Ans: The syntax of proc summary is same as that of proc means, it computes descriptive statistics on numeric variables in the SAS dataset.
Q13. Explain what Proc glm does?
Ans: Proc glm performs simple and multiple regression, analysis of variance (ANOVAL), analysis of covariance, multivariate analysis of variance and repeated measure analysis of variance.
Q14. Explain what is SAS informats?
Ans: SAS INFORMATS are used to read, or input data from external files known as Flat Files ASCII files, text files or sequential files). The informat will tell SAS on how to read data into SAS variables.
Q15. Mention the category in which SAS Informats are placed?
Ans: SAS informats are placed in three categories,
- Character Informats : $INFORMATw
- Numeric Informats : INFORMAT w.d
- Date/Time Informats: INFORMAT w.
Q16. What function CATX syntax does?
Ans: syntax concatenate character strings remove trailing and leading blanks and inserts separators.
Q17. Explain what is the use of PROC gplot?
Ans: PROC gplot has more options and can create more colorful and fancier graphics.
Q18. Mention what is PROC in SAS?
Ans: In SAS, PROC steps analyze and process data in the form of an SAS data set. It controls a library of routines that perform tasks on SAS data set such as sorting, summarizing and listing.
Q19. Mention what is SAS data set?
Ans: A SAS data set is a file consisting of two parts.
- A descriptor portion
- A data portion
Q20. List out some key concept of SAS?
Ans: Some key concept of SAS include,
- SORT procedure
- Missing values
- KEEP=, DROP= dataset options
- Data step logic
- Reset to missing, or the RETAIN statement
- Log
- FORMAT procedure for creating value formats
- Data types
- IN= dataset option
Q21. Mention the difference between INPUT and INFILE ?
Ans:
INFILE | INPUT |
· INFILE statement is used to identify an external file | · INPUT statement is used to describe your variables |
Q22. Mention the difference between INFORMAT and FORMAT ?
Ans:
- INFORMAT: To indicate SAS that a number should be read in a particular format
- FORMAT: To indicate SAS how to print the variables
Q23. Mention what is factor analysis?
Ans:Factor analysis is a common term used for a family of statistical techniques associated with the reduction of a set of observable variables in terms of a small number of latent factors. The main goal of factor analysis is data reduction and summarization.
Q24. Mention how do you read the variables that you need?
Ans: You read the variables using input statement with column /line pointers, informats and length specifiers.
Q25. Mention what are the special input delimiters used in SAS?
Ans: Special input delimiters used in SAS are DLM and DSD.
Q26. Explain how SAS treat the DSD delimiters?
Ans: When you define DSD, SAS treats two consecutive delimiters as a missing value and removes quotation marks from character values.
Q27. Mention what is the good SAS programming practices for processing large data sets?
Ans: The good SAS programming practices for processing large data sets is to sort them once using firstobs= and obs=.
Q28. Mention how to include or exclude specific variables in a data set?
Ans: To include or exclude specific variables in a data set you can use DROP, KEEP Statements and Data set Options.
Q29. Mention how SUBSTR function works in SAS?
Ans: The SUBSTR function is used to abstract substring from a character variable.
Q30. Mention what SAS features do you use to check errors and data validation?
Ans: To check errors, use the Log and for data validation use things like Proc Freq, Proc Means or sometimes Proc print to see how data looks.
Q31. Mention 5 ways to do a “table lookup” in SAS?
Ans: 5 ways to do a “table lookup” in SAS include,
- PROC SQL
- Match Merging
- Direct Access
- Format Tables
- Arrays
Q32. Mention how will you generate test data with no input data?
Ans: You will generate test data with no input data using “put” statement and “Data Null”.
Q33. Mention the difference between CEIL and FLOOR functions in SAS?
Ans: The “floor” returns the greatest integer less than/equal to the argument. Whereas the “ceil” function returns the smallest integer greater than/equal to the argument.
Q34. Mention the difference between SAS functions and procedures?
Ans: The difference between SAS functions and procedures is that
- Procedures expect one variable value per observation
- Functions expect values to be supplied across an observation
Q35. Mention how to remove duplicates using PROC SQL?
Ans: To remove duplicates using PROC SQL use following step,
- Proc SQL noprint;
- Create Table inter.merged1 as
- Select distinct * from inter.readin ;
- Quit;
Q36. Mention common programming errors committed in SAS ?
Ans: Common programming errors committed in SAS are,
- Missing semicolon
- Not checking log after submitting program
- Not using debugging techniques
- Not using Fsview option vigorously
Q37. Mention how to limit decimal places for the variable using PROC MEANS?
Ans: By using MAXDEC=option you can limit decimal places for the variable.
Q38. Mention the difference between the SAS DATA STEP and SAS PROCs?
Ans:
- SAS DATA STEP is used to read in and manipulate data
- SAS PROCs are sub-routines perform tasks on SAS data set
Q39. Mention why a STOP statement is needed for the POINT= option on a SET statement?
Ans: A STOP statement is used to control the continuous looping in SET statement.
Q40. Mention what is RUN-Group processing?
Ans: RUN-Group processing allows submitting a PROC step using RUN statement without ending the procedure.
41) Mention how to test the debugging in SAS?
For debugging in SAS use the Debug clause after ‘/’ in the data statement.
Q42. Mention how to create a permanent SAS data set?
Ans: To create a permanent SAS data set, there are two steps necessary,
- Assign a library and engine.
- Create the data. Make sure to assign both a library (other than WORK) and data set name to make the data set permanent.
Q43. Mention what is SLIBREF?
Ans: SLIBREF is a server-libref. It specifies the libref that is used by the server to identify the SAS data library when no physical name is determined and the server libref is different from the client libref.
Q44. Mention what are the default statistics that PROC MEANS produce?
Ans: The default statistics that PROC MEANS produce are,
- N
- MN
- MAX
- MEAN
- STD DEV
Q45. Mention what is the command used to find missing values?
Ans: The command used to find missing values is
missing_values=MISSING(field1,field2,field3);
Q46. Mention what is the difference between Match Merge and One to One Merge?
Ans: A one-to-one merge is suitable if both data sets in the merge statement are sorted by id and each observation in one data set has a corresponding observation in the other data set. If the observations do not match, then match merging is suitable.
Q47. Mention what are the scrubbing procedures in SAS?
Ans: The scrubbing procedures in SAS are Proc Sort with nodupkey option. It will eliminate the duplicate values.
Q48. Mention what is the use of %include statement?
Ans: %INCLUDE statement reads an entire file into the current SAS program you are running and submits that file to the SAS System immediately.