• USA : +1 973 910 5725
  • INDIA: +91 905 291 3388
  • info@tekslate.com
  • Login

Base SAS Interview Questions

Explain 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 analysis, econometrics and data mining

-Business planning, forecasting and decision support

-Operation research and Project management

-Quality Improvement

-Data Warehousing

-Application Development

Explain what is the basic structure of SAS programming?

The basic structure of SAS are

-Program Editor

-Explorer Window

-Log Window

What is the basic syntax style in SAS?

To run program successfully, and you have following basic elements:

-There should be a semicolon 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: StatHI your filename.dat’;

Explain what is Data Step?

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.

Mention what are the data types does SAS contain?

The data types in SAS are Numeric and Character.

In SAS explain which statement does not perform automatic conversions in comparisons?

In SAS, the “where” statement does not perform automatic conversions in comparisons.

Mention the validation tools used in SAS?

For DataSet : Data set name/ debug Data set: Name/stmtchk
For Macros: Options: mprint mlogic symbolgen

Explain what is the use of function Proc summary?

The syntax of proc summary is same as that of proc means, it computes descriptive statistics on numeric variables in the SAS dataset.

Explain what is SAS informats?

SAS INFORMATS are used to read, or input data from external files known as Flat Files ASCII files, text files or sequential files). The informant will tell SAS on how to read data into SAS variables.

Describe CROSSLIST option in  TABLES statement?

Adding the CROSSLIST option to TABLES statement displays crosstabulation tables in ODS column format.

Enthusiastic about exploring the skill set of SAS Training? Then, have a look at the blog post to gather
 additional knowledge.

What is the difference between One to One Merge and Match Merge? Give example also.

If both data sets in the merge  statement are sorted by id(as shown below) and each observation in one data set has a corresponding observation in the other data set, a one-to-one merge is suitable.

data mydata1;

input id class $;


1 Sa

2 Sd

3 Rd

4 Uj


data mydata2;

input id class1 $;


1 Sac

2 Sdf

3 Rdd

4 Lks


data mymerge;

merge mydata1 mydata2;


If the observations do not match, then match merging is suitable

data mydata1;

input id class $;


1 Sa

2 Sd

2 Sp

3 Rd

4 Uj


data mydata2;

input id class1 $;


1 Sac

2 Sdf

3 Rdd

3 Lks

5 Ujf


data mymerge;

merge mydata1 mydata2;

by id


Describe an SAS function.

TRIM: removes trailing blanks from a character expression

data xyz;
Str1 = ‘my’;
Str2 = ‘dog’;
Result = TRIM(Str1)||TRIM(Str2);

What is the difference between Merge and Proc SQL ?

The resultant dataset depends on the input datasets. In case of one to one and one to many  both work
similarly,i.e. the resultant dataset is same. But differs in case of many to many and non matching datasets:
many to many:
ex:                                     (merge on x)         (proc sql)
X  Y              X    Z           X  Y  Z                X  Y  Z
—–             ——            ——-                 ——-
1  A              1    F            1  A  F                 1  A  F
1  C              1    R —>      1  C  R                 1  A  R
2  B              2    G            2  B  G                1  C  F
1  C  R
2  B  G


ex:                                       (merge on x)    (proc sql)
X  Y              X    Z              X  Y  Z          X  Y  Z
—–             ——                ——-           ——-
1  A              1    F            1  A  F           1  A  F
2  B              3    T    —>    2  B  .            3  C  T
3  C              4    G            3  C  T
4  .  G

What is a PDV?

A PDV or Program Data Vector is a logical area in the memory. SAS creates a database of one observation at a time. At the time of compilation an input buffer is created which holds a record from and external file. The PDV is created following this input buffer creation.

How will you write a code to create a sas dataset with no data in it/ Or How to validate a dataset without actual creating it?


Creating a data set by using the like clause.
 ex: proc sql;
create table latha.emp like oracle.emp;
In this the like clause triggers the existing table structure to be copied to the new table.using this method
result in the creation of an empty table.
 data check;
           set _null_;
data test;
check the above answers.. I have not verified if it will work.

What is a PUT statement?

A PUT statement is a flexible tool in data step programming.

Examples of a PUT statement are:

PUT _all_ – writes the values of all variables

PUT 132*’_’ – writes 132 underscores

PUT one two three – writes three variable values separated by a space.

Mention the category in which SAS Informats are placed?

SAS informats are placed in three categories,

-Character Informats : $INFORMATw

-Numeric Informats : INFORMAT w.d

-Date/Time Informats: INFORMAT w.

What function CATX syntax does?

CATX syntax concatenate character strings remove trailing and leading blanks and inserts separators.

How would you remove a format that has been permanently associated with a variable?

We can remove the format by using proc datasets:
Proc datasets;
modify <data set name>;
format <variable name>(which variable format needs to

What is the difference between Order and Group variable in proc report?

-If the variable is used as group variable, rows that have the same values are collapsed.

-Group variables produce list report whereas order variable produces summary report.

How to specify variables to be processed by the FREQ procedure?

By using TABLES Statement.

Does SAS Translate? (compile) or does it ?Interpret?? Explain.

A typical SAS program could contain DATA steps, PROC steps and macros. Macros are preprocessed. DATA steps are just in time compiled. PROC steps are interpreted in the order they appear in program. So when we submit a SAS program consisting of all these three components, the macro is compiled and executed first. If a DATA step is encountered, then it is compiled and executed. Note that the DATA step will not be executed if there is an error in the compilation. If a PROC step is encountered, it is interpreted and executed line by line. However i am not certain on this PROC step behavior.

Which SAS Statement does not perform automatic conversions in comparisons?

 The “where” statement does not perform automatic conversions in comparisons.

How do you specify variables to be processed by the FREQ procedure?

Use the TABLES statement.

In SAS interviews it’s a good idea to try and keep your answers precise as this helps you come across as confident. Being able to answer questions succinctly is also a very clear indicator of your knowledge.

Explain what is the use of PROC gplot?

PROC gplot has more options and can create more colorful and fancier graphics.

If you have a data set that contains 100 variables, but you need only five of those, what is the code to force SAS to use only those variable?

Use KEEP option on a dataset to only select few variables from 100 variables. We can use KEEP option either on set statement or data step statement. If we use on SET statement then only the five variables are created on pdv and only these variables are sent to the output dataset. If we use KEEP option on data step statement then all the variables are copied into pdv and after any maniuplation only the selected variables on data step statement are processed and sent to output dataset.
Review Date
Reviewed Item
Base SAS Interview Questions
Author Rating

“At TekSlate, we are trying to create high quality tutorials and articles, if you think any information is incorrect or want to add anything to the article, please feel free to get in touch with us at info@tekslate.com, we will update the article in 24 hours.”

2 Responses on Base SAS Interview Questions"

  1. Nilesh Choudhary says:


    Appreciate the work that you have done. I will like to point out an update in the below section :
    Describe an SAS function.

    TRIM: removes trailing blanks from a character expression

    Str1 = ‘my’;
    Str2 = ‘dog’;
    Result = TRIM (Str1)(Str2);
    Result = ‘mydog’

    It should be :
    data xyz;
    Str1 = ‘my’;
    Str2 = ‘dog’;
    Result = TRIM(Str1)||TRIM(Str2);

Leave a Message

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

Site Disclaimer, Copyright © 2016 - All Rights Reserved.


Please leave a message and we'll get back to you soon.

I agree to be contacted via e-mail.