Hi Greq, Welcome to the Forum! _n_ is an automatic variable sas created. In your example, we don't have to use _n_, if we use "i" or some other letters, they will stay in the final dataset as a variable, we need to drop it. When you use a macro variable outsite a macro definition, you have to use double quotes (I maybe wrong about this) . the code below shows the difference to replace _n_ with other letters: %Let var=4D0000001204E6; data test; length x $ 20; retain x; do i=1 to length("&var.") by 2; y=substr("&var.",i,2); x=cats(x,y); output; end; proc print;run; Obs x i y 1 4D 1 4D 2 4D00 3 00 3 4D0000 5 00 4 4D000000 7 00 5 4D00000012 9 12 6 4D0000001204 11 04 7 4D0000001204E6 13 E6 If you don’t want i in final dataset, you need to drop it: %Let var=4D0000001204E6; data test (drop=i) ; length x $ 20; retain x; do i=1 to length("&var.") by 2; y=substr("&var.",i,2); x=cats(x,y); output; end; proc print;run;
... View more