Which function should replace f_name to change text from Court to Drive in the SAS code provided?

Master the SAS Base Programming Certification Exam with our comprehensive study tool. Utilize flashcards and multiple choice questions with detailed explanations. Gear up for success on your exam!

The function that should replace f_name to change text from "Court" to "Drive" in SAS is tranwrd. This function is specifically designed for replacing occurrences of a substring within a character string with a new substring. The syntax is tranwrd(source_string, target_substring, replacement_substring), which makes it straightforward to specify which text to replace and what to replace it with.

For example, if you have a variable containing the text "123 Court St" and you apply tranwrd(variable, 'Court', 'Drive'), the result would be "123 Drive St". This functionality is especially useful when you need to make multiple or specific replacements within strings.

The other functions listed do not perform the same type of substring replacement. While substitute might seem relevant due to its name, it is not a recognized function in SAS for string manipulation. The function translate would change individual characters based on a mapping, not whole words or substrings. Switch does not exist as a SAS string function; it might apply in other languages but not within the SAS environment. Each of these points highlight why tranwrd is the appropriate choice for replacing entire substrings in text.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy