I don't understand why the second and the third observation in C2 only have one blank between the copied string and the repeated string (Shown as 'XXX XXX' and 'Y Y') while there are 5 trailing blanks in 'XXX' and 7 trailing blanks in 'Y'? Does it conflict the results in LC2?
DATA EXAMPLE1;
INPUT GROUP @10 STRING $3.;
LEFT = 'X ';
RIGHT = ' X';
C1 = SUBSTR(GROUP,1,2) ;
C2 = REPEAT(GROUP,1);
LGROUP = LENGTH(GROUP) ;
LSTRING = LENGTH(STRING) ;
LLEFT = LENGTH(LEFT);
LRIGHT = LENGTH(RIGHT);
LC1 = LENGTH(C1);
LC2 = LENGTH(C2);
DATALINES;
ABCDEFGH 123
XXX 4
Y 5 ;
Here is the output: PROC PRINT OUTPUT
You posted a PHOTOGRPAH of ODS output. You cannot tell anything about spaces from either of those. Turn on the plain old LISTING output and look at that.
So assuming you ran something like this:
The output should look like this:
But ODS mangles the outputs to make it look "pretty".
What do you see in the SAS log if you add