The short answer: SAS interviews test whether you can read, combine, clean and summarize data correctly, and find your own errors. The core topics match SAS’s own Base Programming certification guide: creating and accessing data sets, combining them (concatenating and merging), conditional processing, functions for text, numbers and dates, accumulating totals with BY groups, reports with PROC PRINT, MEANS and FREQ, and debugging with the log. Experienced roles add PROC SQL, macros and performance. Below are the common questions with short answers and code.
What SAS’s certification covers
SAS’s exam content guide for the SAS 9.4 Base Programming exam groups the skills into four areas: Access and Create Data Structures (20–25%), Manage Data (35–40%), Error Handling (15–20%), and Generate Reports and Output (15–20%). It’s a good checklist for interview preparation even if you aren’t taking the exam.
Fundamentals
“What’s the difference between a DATA step and a PROC step?”
The DATA step reads and creates data sets, row by row. PROC steps run procedures on existing data, such as sorting, summarizing, reporting or modeling.
“What is a library?”
A reference to a location holding SAS data sets, assigned with LIBNAME. WORK is temporary and deleted at the end of the session; a permanent library keeps data sets.
libname proj "/data/project";
data proj.customers_clean;
set proj.customers;
run;
“How does SAS store dates?”
As numbers: the number of days since January 1, 1960. Informats read dates in, formats display them, and functions such as INTCK, INTNX and YRDIF calculate with them.
Combining data
“What’s the difference between SET and MERGE?”
SET with several data sets stacks (concatenates) them. MERGE with a BY statement joins them side by side by key. Both inputs must be sorted (or indexed) by the BY variables.
proc sort data=orders; by customer_id; run;
proc sort data=customers; by customer_id; run;
data combined;
merge customers(in=a) orders(in=b);
by customer_id;
if a and b; /* keep matches only, like an inner join */
run;
“What happens with a many-to-many merge?”
A DATA step merge doesn’t produce all combinations and writes a note to the log; use PROC SQL when you need a true many-to-many join.
“When would you use PROC SQL instead of a DATA step merge?”
When you need joins on different variable names, many-to-many joins, no pre-sorting, or summaries in one query. A DATA step can be clearer for row-by-row logic.
Conditional processing
“What’s the difference between WHERE and IF?”
WHERE filters observations before they’re read into the DATA step, works in PROCs and can use indexes, but only on variables that already exist in the input. A subsetting IF filters after the row is read, so it can use variables you create in the step.
“DROP and KEEP statements vs DROP= and KEEP= options?”
Statements affect the output data set. Data set options on an input control which variables are read, which can save processing.
Accumulating values
“How do RETAIN and FIRST./LAST. work?”
RETAIN keeps a variable’s value across iterations instead of resetting it to missing. With a BY statement, FIRST.var and LAST.var flag the start and end of each group.
data totals;
set sales;
by region;
if first.region then region_total = 0;
region_total + amount; /* sum statement implies RETAIN */
if last.region then output;
run;
Functions and conversion
“What’s the difference between INPUT and PUT?”
INPUT converts character to numeric (using an informat); PUT converts numeric to character (using a format). Relying on automatic conversion writes notes to the log and can cause errors.
“Name some character functions.”
SCAN, SUBSTR, TRIM, COMPRESS, UPCASE, LOWCASE, plus CATX for concatenation and INDEX or FIND to search.
Procedures
- PROC SORT:
NODUPKEYremoves rows with duplicateBYvalues;NODUPRECSremoves identical consecutive rows;OUT=writes to a new data set. - PROC MEANS and PROC FREQ: summary statistics and frequency tables, by group with
CLASSorBY. - PROC TRANSPOSE: reshape long to wide or wide to long, with
VAR,IDandBY. - ODS: send output to HTML, PDF, RTF or Excel files.
Macros
“What’s a macro variable, and when do you use macros?”
%LET creates a macro variable you reference with &name, to avoid hard-coding values such as dates. %MACRO and %MEND define reusable code blocks with parameters. Use a period to end a macro variable name when text follows it, as in &year.Q1.
Debugging
“How do you find errors in a SAS program?”
Read the log: errors, warnings and notes such as uninitialized variables, character-to-numeric conversion, or missing values generated. Use PUTLOG in the DATA step to print values and trace logic, and test on a small subset.
Scenario and behavioral questions
- “A merge produced more rows than expected. What do you check?” Duplicate keys in one or both data sets.
- “Your report totals don’t match finance’s numbers. How do you investigate?” Compare filters, date ranges, missing values and duplicates step by step.
- “Tell me about an analysis that changed a decision.” See solving a complex problem.
In clinical research and pharmaceutical roles, expect questions on CDISC data standards (SDTM and ADaM) and validation. See also our data engineer interview questions.
Frequently asked questions
What SAS questions are asked in interviews?
What is the difference between WHERE and IF in SAS?
How does SAS store dates?
What is the difference between SET and MERGE in SAS?
What does the SAS Base Programming certification cover?
Sources
- SAS, Exam Content Guide: SAS 9.4 Base Programming – Performance Based Exam (PDF). Read on 1 October 2026.