Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Question: Explain the difference between SAS functions SCAN and SUBSTR.
Answer: 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? Yes No

Most helpful rated by users:

©2025 WithoutBook