06-27-2011 12:09 PM
Basically because you haven't told it not to. CITY is created as 15 characters, the length of FIRST and treated as though that is the desired length.
cc=cats(city, ',' , 'England');
cc=catx(',', city, 'England');
06-27-2011 12:14 PM
This article in the SAS Documention will help http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/viewer.htm#a001336069.htm .
Basically, the problem starts because you've not specified character lengths. SAS then picks the length based on the first value is sees for each variable you've used. "First" is set to 15, "City" copies this and is 15 too, while "CC" is set to 23 (i.e. 15 plus the length of ",England" (8) = 23).
To work for your example you should either set the character lengths, or explore using the "TRIM" function when appending character variables. (Actually you'll probably end up using both.)
Hope that helps!