Statistical Analysis System (SAS) Programming Certification 2025 – 400 Free Practice Questions to Pass the Exam

Image Description

Question: 1 / 400

What method is best for removing extra blanks while concatenating FirstName and LastName into FullName?

fullname=trim(firstname)||' '||lastname;

fullname=trim(firstname)||' '||trim(lastname);

The best method for removing extra blanks while concatenating FirstName and LastName into FullName is to use the trim function on both FirstName and LastName before concatenation.

Using the trim function removes any trailing blanks from each string. By applying it to both FirstName and LastName individually, this approach ensures that any leading or trailing spaces in either name do not affect the final concatenation. When concatenated with a single space in between, this produces a FullName that has no extra spaces.

This method effectively handles the scenarios where either name might inadvertently contain excess spaces, delivering a neater, cleaner FullName result. Thus, the final output will only contain a single space between the two names, making it the most effective solution for the given scenario.

Get further explanation with Examzify DeepDiveBeta

fullname=firstname||' '||lastname;

fullname=trim(firstname||' '||lastname);

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy