The key point made by Tim@SAS is that the charvar1 variable is not going to be trimmed of any trailing blanks -- if this behavior is undesired with your programming needs, you may want to consider also using either the CATT function (new with SAS 9) or using TRIM(charvar1) or possibly if you expect some particular length using the PUT(charvar1,) as well.
What is the answer? Not seeing the question but seeing the intended SAS code, it appears to me that someone is attempting to extract the area code an enclose it in parentheses to create SAS variable "code", right?
thanks, that helps alot to know that when SAS converts automatically to character, it converts to the best12. and right justifies, since the phone number is currently 10 digits, right justifying puts 2 trailing blanks in front and hence the 2 extra spaces.