You are mixing up macro logic and data step logic. The reason that the %PUT is getting an error is that it is compiled BEFORE the data step runs. So the CALL SYMPUT function has not been called yet. In a macro use the %LET statement to assign a value to a macro variable. %macro doit(m,n); %do i=&m %to &n; %let st&i=%eval(&i+1); %end; %mend doit; %doit(1,2); In a data step use the DO statement to loop. %let m=1; %let n=2; data _null_; do i=&m to &n; call symputx(cats('ST',i),i+1); end; run; PS: Do not use DO as the name of a macro as %DO is already a macro statement.
... View more