If you values are numeric then by default the missing value is returned for the CATX function when the numbers are turned into strings to concatenate. Changing the option missing to a blank character means allows CATX to strip the "blanks".

Don't forget to reset the Option after the data step this is needed.

"didnt work for me" is awful vague.

Are there errors in the log?: Post the code and log in a code box opened with the {i} to maintain formatting of error messages.

If you values are numeric then by default the missing value is returned for the CATX function when the numbers are turned into strings to concatenate. Changing the option missing to a blank character means allows CATX to strip the "blanks".

Don't forget to reset the Option after the data step this is needed.

"didnt work for me" is awful vague.

Are there errors in the log?: Post the code and log in a code box opened with the {i} to maintain formatting of error messages.

Re: concatenate non missing values

It seems CATX will deal with missing characters properly, but when it converts the numeric to character it becomes a period which is no longer a 'missing' value. IMO this is not the expected behaviour though it does line up with the documentation.

The CATX function first copies item-1 to the result, omitting leading and trailing blanks. Then for each subsequent argument item-i, i=2, …, n, if item-i contains at least one non-blank character, then CATX appends delimiterand item-i to the result, omitting leading and trailing blanks from item-i. CATX does not insert the delimiter at the beginning or end of the result. Blank items do not produce delimiters at the beginning or end of the result, nor do blank items produce multiple consecutive delimiters.

If item is numeric, then its value is converted to a character string by using the BESTw. format. In this case, SAS does not write a note to the log. For more information, see The Basics.