SAS Programming Guidelines Interview Questions You'll Most .....

Price: $19.95


SAS Programming Guidelines Interview Questions You'll Most Likely Be Asked is a perfect companion to stand ahead above the rest in today’s competitive job market. Rather than going through comprehensive, textbook-sized reference guides, this book includes only the information required immediately for job search to build an IT career. This book puts the interviewee in the driver's seat and helps them steer their way to impress the interviewer.



Table of Contents
1. Efficient SAS Programming
2. Memory Usage
3. Data Storage Space
4. Best Practices
5. Sorting Strategies
6. Samples
7. Using Indexes
8. Combining Data Vertically
9. Combining Data Horizontally
10. Lookup Tables
11. Formatting Data
12. Tracking Changes
13. HR Questions




a) 200 Advanced SAS Interview Questions, Answers and Proven Strategies for getting hired as an IT professional

b) Dozens of examples to respond to interview questions

c) 51 HR Questions with Answers and Proven strategies to give specific, impressive, answers that help nail the interviews

d) 2 Aptitude Tests download available on



Sample from the book
(Below Questions and Answers are randomly taken from different pages of the book)

24: How is free buffer allocated by the SASFILE statement?


The SASFILE statement opens the data file and allocates enough buffers to hold the data in memory. These buffers can be released only when:

a) SASFILE CLOSE statement is used.

Example: In the following program example the SASFILE statement opens the data set exam.clinic1 then allocates the buffer, reads the data into the memory, and it is available to both the proc print as well as proc means step. The last SASFILE statement closes the SAS data file and frees the buffers.


sasfile exam.clinic1 load;

proc print data= exam.clinic1

var slno result;


proc means data= exam.clinic1;


sasfile exam.clinic1 close;


b) SAS session ends so it frees the buffers and closes the file.


27: What factors are considered by SAS when calculating the data storage space required for a SAS data file?


The following factors are considered by SAS when calculating the data storage space required for a SAS data file:

a) Storage space required by the descriptor portion

b) Storage space required by the observations

c) Any storage overhead

d) Storage space required for associated indexes


48: What is the default size of view buffer?


The default size of the view buffer is 32k. The number of observations that can be read into the view buffer depends on observation length. If the observation length is larger than 32k, then only one observation can be read into the buffer at a time.


50: When is the IF-THEN/ELSE statement more used and what best practices should be followed?


The use of IF-THEN/ ELSE statement is more effective when:

a) There are only a few conditions to check

b) The data values are character values

c) The distribution of the values is not uniform


The best practices to be followed while using IF- THEN/ ELSE statement are as follows:

a) The most frequently occurring condition is checked first and continue checking in the decreasing order of frequency

b) When multiple statements are to be executed based on a condition then it is advised to put the statements in a DO group

c) Avoid using parallel IF statements and incorporate ELSE IF condition. The use of parallel IF statement requires each condition to be checked and executed. While using ELSE IF, if the true condition is found subsequent statements are not executed. This results in saving the system resources


Example: The following program example creates a data set exam.result1 from the data set exam.result2. Here the majority of values of the variable result falls into the category of distinction so that condition is checked first. Then conditions are checked in the decreasing order of frequency. When a condition is true, multiple statements are to be executed so the statements are put in a do loop. ELSE IF is used so that while processing an observation if the true condition is found subsequent conditions are not checked for that observation.


libname exam ‘c:myprog’;

data exam.result1;

set exam.result2;

if result = ‘distinction’ then


total = marks1+marks2+marks3;

year = year(ExamDate);

level= 1;


else if result = ‘first class’ then


total = marks1+marks2+marks3;

year = year(ExamDate);

level= 2;




total = marks1+marks2+marks3;

year = year(ExamDate);

level= 3;





89: Which alias is used in place of NUDUPRECS?


NODUP can be used as an alias in place of NODUPRECS.

Example: The following example illustrates the use of the noduprecs option. The use of the noduprecs option causes each observation to compare the value of all the variables with values of variables for previous observation. If it matches, the current observation is not written to the SAS data set. The point to be noted here is that while using noduprecs option, the comparison is not for by variables alone but for all the variables.


proc sort data = exam.results noduprecs;

by category;



In the following program the alias nodup is used in place of noduprecs. The result produced by the program below is identical to the one produced by the above program.


proc sort data = exam.results nodup;

by category;




144: Explain the significance of DIRECTIVES.


DIRECTIVES refers to those special characters used with a picture statement to format date, time or date/time values. Whenever a directive is used with a picture statement, it is required to specify the DATATYPE= option in the PICTURE statement.

Example: The following programs illustrate an example of a directive. The following lines of code create a format startdate. All of the values are included by using the keywords LOW and HIGH. Here all the values are given a label %0d-%b%Y.

%d is a directive used to specify the day of the month. The 0 indicates that if the day of the month is a single digit. It should be preceded by zero.

%d is followed by –

%b is a directive used to indicate the abbreviated month name.

%Y is a directive used to assign the four digit year values. Two spaces are also included within the quotes.

DATATYPE= option is given a value of date since it used to specify the format for a date.


proc format;

picture startdate

low-high='%0d-%b%Y ' (datatype=date);



The following program applies above format, startdate, to the variable, date. So the values of the variable will be displayed as dd-mmmyyyy ( 22-AUG2012).


proc print data=exam.set1;

format date startdate.;




177: Explain the function of DATA_IMAGE audit setting.


DATA_IMAGE audit setting is used to control the storage of record images after update. When DATA_IMAGE audit setting is specified as YES, audit trail will store the record images updated

Example: The following program initiates an audit trail on the data set exam.set1. The audit setting after_image is set to yes, so the audit trail store the record images after an update. Also the error_image is set to yes. So those records are also stored in the audit trail whose updating produced the error.


proc datasets lib= exam;

audit set1;


log after_image =yes error_image = yes;