Statistical Analysis System (SAS) Programming Certification Practice Exam

Disable ads (and more) with a membership for a one time $2.99 payment

Prepare for the SAS Programming Certification Exam with our comprehensive quiz. Study with multiple-choice questions, detailed explanations, and helpful hints to boost your confidence. Ace your certification test!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


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

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

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

  3. fullname=firstname||' '||lastname;

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

The correct answer is: 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.