By the way your SCAN is including SPACE as a delimiter. So If one of your values in delimited list includes a space that is counted as well. If you do not want to use a space as a delimiter do not include them in the third parameter
Instead of
Code_C&i. = scan(Code&I., 12, ' : ') ;
to not include space as delimiter
Code_C&i. = scan(Code&I., 12, ':') ;
Data as an example is helpful because otherwise we have to make guesses as to what valid values may look like and quite often those guesses can be wrong.
@Vasundha wrote:
Hello Experts,
I'd be grateful if you could assist me on this.
I've a table with some columns named Code1-Code5. In these columns I've values separated with colon (:). So, for that I've written a macro .
Here's it is.
%macro abc;
Data xyz;
Set xyz;
%do i =1 %to 5;
Code_C&i. = scan(Code&I., 12, ' : ') ;
%end;
run;
%mend abc;
%abc
In this code, the new variables are getting created but there are no values in it. Im having blank values in them.
I've no clue why it isn't providing values the way it is supposed to. Please help me out on this.
... View more