152k views
5 votes
Suppose you need to create the variable FullName by concatenating the values of FirstName, which contains first names, and LastName, which contains last names. Which DATA step results in values of FullName that have one blank between first and last names?

a.
data work.maillist;
set retail.maillist;
length FullName $ 40;
FullName=trim(FirstName)||' '||LastName;
run;
b.
data work.maillist;
set retail.maillist;
length FullName $ 40;
FullName=trim(FirstName||' '||LastName);
run;

1 Answer

2 votes

Final answer:

The correct DATA step to create the variable FullName with one blank between first and last names is option a.

Step-by-step explanation:

The correct DATA step to create the variable FullName with one blank between first and last names is option a.

The DATA step in option a uses the concatenation operator '||' to combine the values of FirstName and LastName with a space in between. The trim function is used to remove any leading or trailing blanks. The resulting value is stored in FullName.

On the other hand, option b concatenates FirstName with ' ' and LastName together without trimming the extra space between them.

User Tanesia
by
8.0k points