04-30-2015 05:52 AM
I suspect that what you are missing is variable length. As you do not specify how long JoBC is it is defaulted to 2 characters after the first assignment. When you concat on the "1" that makes 3 chars and the last is dropped. Always be explicit in your definitions!
length JoBC $20;
04-30-2015 09:21 AM
Your question happens to tap on one of the fundamental features of SAS. SAS, specifically speaking 'data step', only supports fixed length variable as a programming language. For your purpose, you will have to either give a long enough length for a variable upfront or not using 'data step'.
/*length of var1 is predefined by the incoming dataset, length = 2*/
/*length of var1 is redefined as 20*/
length var1 $ 20;
/*SQL works on completely different mechanism*/
create table want_sql as select cats(var1,var2) as var1, var2 from have;
04-30-2015 09:30 AM
As previously noted, there can be issues with lengths of variables. The easiest way to program around this might be to rename:
newvar = JoBC || JoBL;
rename newvar = JoBC;