Linus Hjorth provides the reason and solution, I would question why you are doing this. Is there really a reason to create x number of macro variable lists? Are you going to code all your programs using macro lists? There are generally better ways, e.g. normalizing data, using by groups, arrays, code generation, hash tables, clever SQL joining etc. Without knowing your requirements its a bit hard to say, but this should simplify creating macro lists (if that is what you really need to do): data have; diagkode="AB"; diag_23=1; output; diagkode="CD"; diag_23=1; output; diagkode="RT"; diag_23=2; output; run; proc transpose data=have out=inter; by diag_23; var diagkode; run; data _null_; set inter; array col{2}; /* Note you can get this by max(diag_23) */ call symput('DIAG'||strip(put(diag_23,best.)),catx(',',of col(*))); run; %put &diag1.; %put &diag2.;
... View more