300+ TOP SAS Interview Questions and Answers

SAS Interview Questions for freshers experienced :-

1. What is SAS? What are the functions does it performs?
SAS means Statistical Analysis System, which is an integrated set of software products.

  • Information retrieval and data management
  • Writing reports and graphics
  • Statistical analytics, econometrics and data mining
  • Business planning, forecasting, and decision support
  • Operation research and Project management
  • Quality Improvement
  • Data Warehousing
  • Application Development

2. What is the basic structure of the SAS base program?
The basic structure of SAS consist of

==DATA step, which recovers & manipulates data.
==PROC step, which interprets the data.

3. What is the basic syntax style in SAS?
To run the program successfully, and you have the following basic elements:

  1. There should be a semi-colon at the end of every line
  2. A data statement that defines your data set
  3. Input statement
  4. There should be at least one space between each word or statement
  5. A run statement
    For example: In file ‘H: \StatHW\yourfilename.dat’;

4. Explain data step in SAS
The Data step creates a SAS dataset which carries the data along with a “data dictionary.” The data dictionary holds information about the variables and their properties.

5.What is PDV?
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.

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

7. Identify statements whose placement in the DATA step is critical.
INPUT, DATA and RUN…

8. Does SAS ‘Translate’ (compile) or does it ‘Interpret’?
Compile

9. What does the RUN statement do?
When SAS editor looks at Run it starts compiling the data or proc step, if you have more than one data step or proc step or if you have a proc step. Following the data step then you can avoid the usage of the run statement.

10. Why is SAS considered self-documenting?
SAS is considered self documenting because during the compilation time it creates and stores all the information about the data set like the time and date of the data set creation later No. of the variables later labels all that kind of info inside the dataset and you can look at that info using proc contents procedure.

SAS Interview Questions
SAS Interview Questions

11. What are some good SAS programming practices for processing very large data sets?
Sort them once, can use firstobs = and obs = ,

12. What is the different between functions and PROCs that calculate the same simple descriptive statistics?
Functions can used inside the data step and on the same data set but with proc’s you can create a new data sets to output the results. May be more ………..

13. If you were told to create many records from one record, show how you would do this using arrays and with PROC TRANSPOSE?
I would use TRANSPOSE if the variables are less use arrays if the var are more …………….. depends

14. What is a method for assigning first.VAR and last.VAR to the BY groupvariable on unsorted data?
In unsorted data you can’t use First. or Last.

15. How do you debug and test your SAS program?
First thing is look into Log for errors or warning or NOTE in some cases or use the debugger in SAS data step.

16. What other SAS features do you use for error trapping and data validation?
Check the Log and for data validation things like Proc Freq, Proc means or some times proc print to look how the data looks like ……..

17. How would you combine 3 or more tables with different structures?
I think sort them with common variables and use merge statement. I am not sure what you mean different structures.

18. What areas of SAS are you most interested in?
BASE, STAT, GRAPH, ETSBriefly

19. Describe 5 ways to do a “table lookup” in SAS.
Match Merging, Direct Access, Format Tables, Arrays, PROC SQL

20. What versions of SAS have you used (on which platforms)?
SAS 9.1.3,9.0, 8.2 in Windows and UNIX, SAS 7 and 6.12

21. What are some good SAS programming practices for processing very large data sets?
Sampling method using OBS option or subsetting, commenting the Lines, Use Data Null

22. What are some problems you might encounter in processing missing values? In Data steps? Arithmetic? Comparisons? Functions? Classifying data?
The result of any operation with missing value will result in missing value. Most SAS statistical procedures exclude observations with any missing variable vales from an analysis.

23. How would you create a data set with 1 observation and 30 variables from a data set with 30observations and 1 variable?
Using PROC TRANSPOSE

24. What is the different between functions and PROCs that calculate the same simple descriptive statistics?
Proc can be used with wider scope and the results can be sent to a different dataset. Functions usually affect the existing datasets.

25. If you were told to create many records from one record, show how you would do this using array and with PROC TRANSPOSE?
Declare array for number of variables in the record and then used Do loop Proc Transpose with VARstatement

26. What are _numeric_ and _character_ and what do they do?
Will either read or writes all numeric and character variables in dataset.

27. How would you create multiple observations from a single observation?
Using double Trailing @@

28. For what purpose would you use the RETAIN statement?
The retain statement is used to hold the values of variables across iterations of the data step. Normally, all variables in the data step are set to missing at the start of each iteration of the data step.What is the order of evaluation of the comparison operators: + – * / ** ()?(), **, *, /, +, –

29. How could you generate test data with no input data?
Using Data Null and put statement

30. How do you debug and test your SAS programs?
Using Obs=0 and systems options to trace the program execution in log.

31. What can you learn from the SAS log when debugging?
It will display the execution of whole program and the logic. It will also display the error with line number so that you can and edit the program.

32. What is the purpose of _error_?
It has only to values, which are 1 for error and 0 for no error.

33. How can you put a “trace” in your program?
By using ODS TRACE ON

34. How does SAS handle missing values in: assignment statements, functions, a merge, an update, sort order, formats, PROCs?
Missing values will be assigned as missing in Assignment statement. Sort order treats missing as second smallest followed by underscore.

35. How do you test for missing values?
Using Subset functions like IF then Else, Where and Select.

36. How are numeric and character missing values represented internally?
Character as Blank or “ and Numeric as.

37. Which date functions advances a date time or date/time value by a given interval?
INTNX.

38. In the flow of DATA step processing, what is the first action in a typical DATA Step?
When you submit a DATA step, SAS processes the DATA step and then creates a new SAS data set.( creation of input buffer and PDV)

  1. Compilation Phase
  2. Execution Phase

39. What are SAS/ACCESS and SAS/CONNECT?
SAS/Access only process through the databases like Oracle, SQL-server, Ms-Access etc. SAS/Connect only use Server connection.

40. What is the one statement to set the criteria of data that can be coded in any step?
OPTIONS Statement, Label statement, Keep / Drop statements.

41. What is the purpose of using the N=PS option?
The N=PS option creates a buffer in memory which is large enough to store PAGESIZE (PS) lines and enables a page to be formatted randomly prior to it being printed.

42. What are the scrubbing procedures in SAS?
Proc Sort with nodupkey option, because it will eliminate the duplicate values.

43. What are the new features included in the new version of SAS?
The main advantage of version9 is faster execution of applications and centralized access of data and support.

  • There are lots of changes has been made in the version 9 when we compared with the version8. The following are the few:SAS version 9 supports Formats longer than 8 bytes & is not possible with version 8.
  • Length for Numeric format allowed in version 9 is 32 where as 8 in version 8.
  • Length for Character names in version 9 is 31 where as in version 8 is 32.
  • Length for numeric informat in version 9 is 31, 8 in version 8.
  • Length for character names is 30, 32 in version 8.3 new informats are available in version 9 to convert various date, time and datetime forms of data into a SAS date or SAS time.

·ANYDTDTEW. – Converts to a SAS date value ·ANYDTTMEW. – Converts to a SAS time value. ·ANYDTDTMW. -Converts to a SAS datetime value.CALL SYMPUTX Macro statement is added in the version 9 which creates a macro variable at execution time in the data step by ·

Trimming trailing blanks · Automatically converting numeric value to character.
New ODS option (COLUMN OPTION) is included to create a multiple columns in the output.

44. WHAT DIFFERRENCE DID YOU FIND AMONG VERSION 6 8 AND 9 OF SAS.
The SAS 9
Architecture is fundamentally different from any prior version of SAS. In the SAS 9 architecture, SAS relies on a new component, the Metadata Server, to provide an information layer between the programs and the data they access. Metadata, such as security permissions for SAS libraries and where the various SAS servers are running, are maintained in a common repository.

45. What has been your most common programming mistake?
Missing semicolon and not checking log after submitting program,
Not using debugging techniques and not using Fsview option vigorously.

Name several ways to achieve efficiency in your program.Efficiency and performance strategies can be classified into 5 different areas.

  • CPU time
  • Data Storage
  • Elapsed time
  • Input/Output
  • Memory CPU Time and Elapsed Time- Base line measurements

46. Few Examples for efficiency violations:Retaining unwanted datasets Not sub setting early to eliminate unwanted records.
Efficiency improving techniques:
Using KEEP and DROP statements to retain necessary variables. Use macros for reducing the code.
Using IF-THEN/ELSE statements to process data programming.
Use SQL procedure to reduce number of programming steps.
Using of length statements to reduce the variable size for reducing the Data storage.
Use of Data _NULL_ steps for processing null data sets for Data storage.

47. What other SAS products have you used and consider yourself proficient in using?
Data _NULL_ statement, Proc Means, Proc Report, Proc tabulate, Proc freq and Proc print, Proc Univariate etc.

What is the significance of the ‘OF’ in X=SUM (OF a1-a4, a6, a9);If don’t use the OF function it might not be interpreted as we expect. For example the function above calculates the sum of a1 minus a4 plus a6 and a9 and not the whole sum of a1 to a4 & a6 and a9. It is true for mean option also.

48. How to use IF THEN ELSE in PROC SQL?

PROC SQL;
SELECT WEIGHT,
CASE
WHEN WEIGHT BETWEEN 0 AND 50 THEN ’LOW’
WHEN WEIGHT BETWEEN 51 AND 70 THEN ’MEDIUM’
WHEN WEIGHT BETWEEN 71 AND 100 THEN ’HIGH’
ELSE ’VERY HIGH’
END AS NEWWEIGHT FROM HEALTH;
QUIT;

49. How to remove duplicates using PROC SQL?

Proc SQL noprint;
Create Table inter.Merged1 as
Select distinct * from inter.readin ;
Quit;

50. How to count unique values by a grouping variable?

You can use PROC SQL with COUNT(DISTINCT variable_name) to determine the number of unique values for a column.

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

52. What is the effect of the OPTIONS statement ERRORS=1?
The –ERROR- variable ha a value of 1 if there is an error in the data for that observation and 0 if it is not.

53. What do the SAS log messages “numeric values have been converted to character” mean? What are the implications?
It implies that automatic conversion took place to make character functions possible.

54. Why is a STOP statement needed for the POINT= option on a SET statement?
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.

55. How do you control the number of observations and/or variables read or written?
FIRSTOBS and OBS option

SAS Questions and Answers Pdf Download

Leave a Reply

Your email address will not be published. Required fields are marked *