Base SAS code is always fun. What if you don't know the length of the strings but you do know that space is the separator and that you want the first chunk from A and the third chunk from B. Use the scan function.
length c $32 ;
c= scan(a,1,' ') !! ' ' !! scan(b,3,' ');
Now, what if you don't know how many chunks there are in B, but you know you want the last? Use the reverse function.
length c $32 ;
c= scan(a,1,' ') !! ' ' !! reverse(scan(reverse(b),1,' '));
When using EM 5.3 or 6.1, you can enter the expression directly into the SCORE code editor in the CODE node or the TRANSFORM Node. You do not need to enter DATA, SET, or RUN statements. The code will be inserted into the diagram's score code.
What if you want to use the variable C in a model but you want to reject A and B? You can do this in your CODE node as well. The CODE node has editors for TRAIN, SCORE, and REPORT code. Enter this code into the TRAIN code.
%EM_METACHANGE(name=A, role=rejected) ;
%EM_METACHANGE(name=B, role=rejected) ;
The new variable C will have the role of input by default. If you want to set that explicitly, you can do this:
%EM_METACHANGE(name=C, role=input, level=nominal) ;
You do NOT want to drop A and B from the data since that will cause the score code to fail when the expression that creates C is evaluated after a temporary data set has been created.
In general, EM does not drop variables from the data set, and does not change the values of existing variables.
cheers.