I don't know what "expected result" you are seeing (not seeing?), but you can use the NLENG function to see the length of a character matrix. That is the length of the variable that is written to the SAS data set. Run the following, which should show that the SAS/IML vector contains 11 characters per element and that 11 is the length of the data set variable:
vector = J(5,1,BlankStr(11));
L = nleng(vector);
DO i=1 TO 5;
vector[i] = char(i) + 'M';
CREATE vector var "vector"; APPEND; CLOSE;
ods select Variables;
proc contents data=vector;
Is the issue here the default length of the string returned by the CHAR function? If the default is 12, then each string will have 11 leading blanks before the number. Try using strip(char(i)) instead of char(i) to remove the blanks.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.