TOP SAS Interview Questions and Answers

Read Latest SAS Interview Questions and Answers for Freshers, 2+ Years Experienced Q and A with Explanation PDF.


SAS/Access only process through the databases like Oracle, SQL-server, Ms-Access etc. SAS/Connect only use Server connection.

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.

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.

What are the scrubbing procedures in SAS?

Proc Sort with nodupkey option, because it will eliminate the duplicate values.

What are the new features included in the new version of SAS i.e., SAS9.1.3?

The main advantage of version 9 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 version 8. 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.

What do the PUT and INPUT functions do?

INPUT function converts character data values to numeric values.
PUT function converts numeric values to character values.EX: for INPUT: INPUT (source, informat)

For PUT: PUT (source, format)

Note that INPUT function requires INFORMAT and PUT function requires FORMAT.

If we omit the INPUT or the PUT function during the data conversion, SAS will detect the mismatched variables and will try an automatic character-to-numeric or numeric-to-character conversion. But sometimes this doesn’t work because $ sign prevents such conversion. Therefore it is always advisable to include INPUT and PUT functions in your programs when conversions occur.

Which date function advances a date, time or datetime value by a given interval?


INTNX function advances a date, time, or datetime value by a given interval, and returns a date, time, or datetime value. Ex: INTNX(interval,start-from,number-of-increments,alignment)

INTCK: INTCK(interval,start-of-period,end-of-period) is an interval functioncounts the number of intervals between two give SAS dates, Time and/or datetime.

DATETIME () returns the current date and time of day.

DATDIF (sdate,edate,basis): returns the number of days between two dates.

How might you use MOD and INT on numeric to mimic SUBSTR on character Strings?

The first argument to the MOD function is a numeric, the second is a non-zero numeric; the result is the remainder when the integer quotient of argument-1 is divided by argument-2. The INT function takes only one argument and returns the integer portion of an argument, truncating the decimal portion. Note that the argument can be an expression.

A = 123456 ;
X = INT( A/1000 ) ;
Y = MOD( A, 1000 ) ;
Z = MOD( INT( A/100 ), 100 ) ;
PUT A= X= Y= Z= ;

In ARRAY processing, what does the DIM function do?

DIM: It is used to return the number of elements in the array. When we use Dim function we would have to re –specify the stop value of an iterative DO statement if u change the dimension of the array.

How would you determine the number of missing or nonmissing values in computations?

To determine the number of missing values that are excluded in a computation, use the NMISS function.

data _null_;
m = . ;
y = 4 ;
z = 0 ;
N = N(m , y, z);
NMISS = NMISS (m , y, z);

The above program results in N = 2 (Number of non missing values) and NMISS = 1 (number of missing values).

Do you need to know if there are any missing values?

Just use: missing_values=MISSING(field1,field2,field3);
This function simply returns 0 if there aren’t any or 1 if there are missing values.If you need to know how many missing values you have then use num_missing=NMISS(field1,field2,field3);
You can also find the number of non-missing values with non_missing=N (field1,field2,field3);

What are the validation tools in SAS?

For dataset: Data set name/debugData set: name/stmtchk
For macros: Options:mprint mlogic symbolgen.

How can you put a “trace” in your program?

ODS Trace ON, ODS Trace OFF the trace records.

How would you code a merge that will keep only the observations that have matches from both data sets?

Using “IN” variable option. Look at the following example.
data three;
merge one(in=x) two(in=y);
by id;
if x=1 and y=1;

data three;
merge one(in=x) two(in=y);
by id;
if x and y;

What are input dataset and output dataset options?

Input data set options are obs, firstobs, where, in output data set options compress, reuse.Both input and output dataset options include keep, drop, rename, obs, first obs.


Popular posts from this blog

TOP Agile Testing Interview Questions and Answers

Latest Agile Testing Interview Questions and Answers

Most Asked ADO.NET Interview Questions and Answers