Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

SAS Interview Questions and Answers

Ques 16. Explain the difference between SAS functions SCAN and SUBSTR.

SCAN is used to extract words from a string based on a specified delimiter, while SUBSTR is used to extract a substring from a given position in a string.

Example:

DATA parsed_dataset; SET original_dataset; /* Extract second word from variable */ new_variable = SCAN(variable, 2); /* Extract substring starting at position 3 */ another_variable = SUBSTR(variable, 3); RUN;

Is it helpful? Add Comment View Comments
 

Ques 17. What is the purpose of the SORT procedure in SAS?

The SORT procedure in SAS is used to sort a dataset based on one or more variables. It can be used to arrange data in ascending or descending order.

Example:

PROC SORT DATA=unsorted_dataset OUT=sorted_dataset; BY variable; RUN;

Is it helpful? Add Comment View Comments
 

Ques 18. How do you concatenate datasets vertically in SAS?

The SET statement is used to concatenate datasets vertically in SAS. All datasets must have the same variables in the same order.

Example:

DATA combined_dataset; SET dataset1 dataset2; RUN;

Is it helpful? Add Comment View Comments
 

Ques 19. What is the purpose of the SQL procedure in SAS?

The SQL procedure in SAS is used to perform SQL queries on SAS datasets. It allows for data manipulation, retrieval, and aggregation using SQL syntax.

Example:

PROC SQL; SELECT variable1, AVG(variable2) AS avg_value FROM dataset GROUP BY variable1; QUIT;

Is it helpful? Add Comment View Comments
 

Ques 20. Explain the difference between SAS formats and informats.

Formats are used to control the appearance of data values in output, while informats are used to read data values during input. They are applied using the FORMAT and INFORMAT statements, respectively.

Example:

DATA formatted_dataset; SET original_dataset; FORMAT date_variable DATE9.; /* Apply format to date variable */ INPUT name $20. age height; /* Apply informat to age and height variables */ INFORMAT age 3. height 5.; DATALINES; John 25 180 Alice 30 165 ; RUN;

Is it helpful? Add Comment View Comments
 

Most helpful rated by users:

©2025 WithoutBook