- SAS Tutorial
- SAS - Home
- SAS - Overview
- SAS - Environment
- SAS - User Interface
- SAS - Program Structure
- SAS - Basic Syntax
- SAS - Data Sets
- SAS - Variables
- SAS - Strings
- SAS - Arrays
- SAS - Numeric Formats
- SAS - Operators
- SAS - Loops
- SAS - Decision Making
- SAS - Functions
- SAS - Input Methods
- SAS - Macros
- SAS - Dates & Times

- SAS Data Set Operations
- SAS - Read Raw Data
- SAS - Write Data Sets
- SAS - Concatenate Data Sets
- SAS - Merging Data Sets
- SAS - Subsetting Data Sets
- SAS - Sort Data Sets
- SAS - Format Data Sets
- SAS - SQL
- SAS - Output Delivery System
- SAS - Simulations

- SAS Data Representation
- SAS - Histograms
- SAS - Bar Charts
- SAS - Pie Charts
- SAS - Scatterplots
- SAS - Boxplots

- SAS Basic Statistical Procedure
- SAS - Arithmetic Mean
- SAS - Standard Deviation
- SAS - Frequency Distributions
- SAS - Cross Tabulations
- SAS - T Tests
- SAS - Correlation Analysis
- SAS - Linear Regression
- SAS - Bland-Altman Analysis
- SAS - Chi-Square
- SAS - Fishers Exact Tests
- SAS - Repeated Measure Analysis
- SAS - One-Way Anova
- SAS - Hypothesis Testing

- SAS Useful Resources
- SAS - Quick Guide
- SAS - Useful Resources
- SAS - Questions and Answers
- SAS - Discussion

# SAS - Questions and Answers

Dear readers, these SAS Interview Questions have been designed specially to get you acquainted with the nature of questions you may encounter during your interview for the subject of SAS programming. As per my experience good interviewers hardly plan to ask any particular question during your interview, normally questions start with some basic concept of the subject and later they continue based on further discussion and what you answer −

The DO WHILE expression is evaluated at the top of the DO loop. If the expression is false the first time it is evaluated, then the DO loop never executes. Whereas DO UNTIL executes at least once.

Character, Numeric

By using MAXDEC= option

The difference between the two procedures is that PROC MEANS produces a report by default. By contrast, to produce a report in PROC SUMMARY, you must include a PRINT option in the PROC SUMMARY statement.

By using TABLES Statement.

The double trailing sign (@@) tells SAS rather than advancing to a new record, hold the current input record for the execution of the next INPUT statement.

Using DROP, KEEP Statements and Data set Options.

It produce the default statistics of MIN, MAX, MEAN and STD DEV.

PDV is a logical area in the memory.PDV is created followed by the creation of input buffer. SAS builds dataset in the PDV area of memory

It can also be used to write output without creating a dataset.

By using PROC SORT with NODUPKEY and NODUP Options.

The NODUPKEY option removes duplicate observations where value of a variable listed in BY statement is repeated while NODUP option removes duplicate observations where values in all the variables are repeated (identical observations)

Use DESCENDING keyword in PROC SORT code.

By creating a differently-named variable using the PUT function.

By creating a differently-named variable using the INPUT function.

SET concatenates the data sets where as MERGE matches the observations of the data sets

SYMPUT puts the value from a dataset into a macro variable where as SYMGET gets the value from the macro variable to the dataset.

INTNX function advances a date, time, or datetime value by a given interval, and returns a date, time, or datetime value

A RETAIN statement tells SAS not to set variables to missing when going from the current iteration of the DATA step to the next. Instead, SAS retains the values.

%EVAL cannot perform arithmetic calculations with operands that have the floating point values. It is when the %SYSEVALF function comes into picture.

It performs simple and multiple regression, analysis of variance (ANOVAL), analysis of covariance, multivariate analysis of variance and repeated measure analysis of variance.

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

Scan(argument,n,delimiters)

Scan, Substr, trim, Catx, Index, tranwrd, find, Sum.

TRANWRD function replaces or removes all occurrences of a pattern of characters within a character string.

The INFILE statement is used to identify an external file while the INPUT statment is used to describe your variables.

When the MISSOVER option is used on the INFILE statement, the INPUT statement does not jump to the next line when reading a short line. Instead, MISSOVER sets variables to missing

Using the FIRSTOBS = and OBS = statements.

SUM function returns the sum of non-missing arguments whereas “+” operator returns a missing value if any of the arguments are missing.

The SUBSTR function is used to extract substring from a character variable.

The ceil function returns the smallest integer greater than/equal to the argument whereas the floor returns the greatest integer less than/equal to the argument.

SCAN extracts words within a value that is marked by delimiters. SUBSTR extracts a portion of the value by stating the specific location. It is best used when we know the exact position of the sub string to extract from a character value.

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

There are some system options that can be used to debug SAS Macros:MPRINT, MLOGIC, SYMBOLGEN

Use PROC PRINTTO

Data Step MERGE does not create a cartesian product incase of a many-to-many relationship. Whereas, Proc SQL produces a cartesian product.

2 bytes and 1 byte.

Procs are sub-routines with a specific purpose in mind and the data step is designed to read in and manipulate data.

PUT (formatted) statement in data step.

where statement

Input function – Character to numeric conversion- Input(source,informat) and put function – Numeric to character conversion- put(source,format)

No, it must be character data type.

The number of observations is limited only by computer’s capacity to handle and store them.

By using MAXDEC= option

BY processing requires that your data already be sorted or indexed in the order of the BY variables.

By using TABLES Statement.

Five

proc means will give descreptive statitstics. By default it will give output in output window.but proc summary will not give output as default.we need give an option print then only it will give the output.

Use the Debug clause after '/' in the data statement.

Using the MISSOVER keyword.