Are you sure that you are getting exactly what you want? I may have missed something but your data _null_ module should have double&. That should cure your warning message.
In your example the macro processor replaces the &i and the &theID at the "same time" so SAS is looking for &i which it can find but it can't find &theID b/c it doesn't exist. With a double ampersand, SAS resolves the && to a single &. So when the macro facility sees &&theID&i, the first iteration will look like &theID1 then &theID1 gets resolved. Cynthia and others on this site have offered much more elegant explainations.
See my examples
Try this:
data _null_;
%do i=1 %to &obscnt;
%SingleUpdate("&&theID&i", "&&theDesc&i");
%end;
run;
See my example to show how the && and & resolve
data test;
input id desc $;
datalines;
1 NORTH
2 SOUTH
3 EAST
4 WEST
;
run;
%macro test_macro;
data _null_;
set test end=eof;
call symput('theID'||strip(put(_n_,best.)),strip(put(id,best.)));
call symput('theDESC'||strip(put(_n_,best.)),strip(desc));
if eof then call symput ('obscnt',strip(put(_n_,best.)));
run;
proc sql;
select *
from dictionary.macros
where name like 'THEID%' or name like 'THEDESC%' or name eq 'OBSCNT';
quit;
%put Will Generate a Warning;
%do i=1 %to &obscnt;
%put '&theID&i'=&theID&i '&theDESC&i'=&theDESC&i;
%end;
%put;
%put Will Not Generate a Warning;
%do i=1 %to &obscnt;
%put '&&theID&i'=&&theID&i '&&theDESC&i'=&&theDESC&i;
%end;
%mend test_macro;
%test_macro;
-Regards/
Darryl
... View more