Which of the following functions would you use to ensure that both leading and trailing spaces are removed from a string?

Boost your career with the SAS Base Exam Certification. Dive into multiple choice questions, detailed explanations, and flashcards to enhance your understanding and ace your exam!

The STRIP function is used in SAS to remove both leading and trailing spaces from a string. This function is particularly useful when you want to clean up data that may have unnecessary spaces before or after the actual content. By employing the STRIP function, you ensure that any unwanted spaces are eliminated, allowing for more accurate comparisons and data processing.

While the TRIM function only removes trailing spaces and not leading spaces, the STRIP function combines this functionality to handle spaces on both sides of the string. Other functions like SUBSTR are used for extracting parts of a string and CATX is used for concatenating strings with a specified delimiter, but neither addresses the issue of removing spaces effectively. Thus, choosing STRIP is the correct approach when the goal is to sanitize a string by removing spaces from both ends.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy