Professional Documents
Culture Documents
14/12/2019 Top 20 SAS Interview Questions and Answers - Tutorial And Example
May 6, 2019
by
SAS DATA step retrieves and manipulates data and starts with DATA keyword. It produces a SAS data set named DISTANCE. It is used for
getting input data into a SAS dataset and also for editing i.e., checks errors in data and corrects them.
SAS PROC analyzes the data. The PROC statement starts beginning of all procedures in SAS.
SAS OUTPUT step throws the result of analyzed data. A program ends when the PROC step ends with RUN statement. It is used to save
summary statistics in a SAS data set.
4. What are the syntax rules of a SAS program?
There are three components of a SAS program with syntax rules as follows:
SAS statements
1. Statements can begin and stop anywhere, and there should be a semicolon at the end of every line as the end mark.
2. Multiple statements can lie on the same line in which each statement ends with a semicolon.
3. The components in a SAS program can be separated by using space.
4. Every SAS program must end with RUN statement.
SAS Variables
1. Length of a Variable name can be up to 32 characters.
2. A variable name will be without blank.
3. A variable name must start with any character (not case sensitive)or an underscore (_).
4. A variable name can include number excepting its first character.
5. Variable names are case insensitive.
SAS Data Set
1. The name of a SAS Data Set can be prefixed with a library name which makes it a permanent Data Set such that it will be persisted even after
the session get over.
2. A single word after the DATA statement indicates a temporary data set name by which a data set gets erased at session end.
3. If a SAS data set name get erased then SAS creates a data set whose name gets generated by SAS like (DATA1, DATA2, etc.)
https://www.tutorialandexample.com/sas-interview-questions/ 2/4
5. What is PDV?
14/12/2019 Top 20 SAS Interview Questions and Answers - Tutorial And Example
PDV (Program Data Vector) represents a logical area of memory that is formed at the time of DATA step processing and can also be created by the
MERGE, SET, MODIFY or UPDATE statements in Data Step. It is a storage place where SAS builds the Data Set by reading one observation at a time.
An input buffer is created during the compilation phase which holds a record from an external file.
There are two types of variables encountered for every DATA step:
1. Permanent (Data Set and computed variables)
2. Temporary (Automatically generated and Option defined)
6. How many data types in SAS ?
SAS consists of two data types: Character and Numeric. Apart from these, dates also exists as characters although there are implicit functions to work
upon dates.
7. What are _N_ and _Error_ in SAS?
_N_ and _Error_ are the temporary variables in SAS that gets generated automatically by the DATA step processing.
8. Difference between PROC MEANS and PROC SUMMARY.
PROC MEANS produces a printable output by default while a PROC SUMMARY statement requires a PRINT option.
PROC MEANS procedure produces default statistics (N, Mean, Standard Deviation, Minimum and Maximum) while PROC SUMMARY procedure
provides the values _type_, _freq_, and _stat_.
9. Differences between One-to-One Merging and Match Merging.
One-to-one merging combines observations from multiple data sets into a single observation in a new SAS data set while Match-merging does
this process according to the values of a common variable.
One-to-one merging uses the MERGE statement without BY statement while Match-merging use BY statement at just after the MERGE
statement.
One-to-one merging is suitable for matching observations while Match-merge is suitable if the observations do not match.
https://www.tutorialandexample.com/sas-interview-questions/ 3/4
10. How to create a permanent SAS data set?
14/12/2019 Top 20 SAS Interview Questions and Answers - Tutorial And Example