Okay, let's use more efficient functions. Say, the test data was generated as
data test;
do i=1 to 10;
id = int(ranuni(0)*1000 + 0.5);
desc = int(ranuni(0)*20 + 0.5);
output;
end;
drop i;
run;
Then your codes
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;
%put _user_;
Nothing wrong, but too fuzzy with quotes. How about with the new functions?
data _null_;
set test end=eof;
call symputx(catt('theID', _n_), id);
call symputx(catt('theDESC', _n_), desc);
if eof then call symputx('obscnt', _n_);
run;
%put _user_;
Same macro variables, but no more
NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).
927:54
You don't need to use ||, ", ', best, strip, trim, etc.
symputx, catt, catx, etc are efficient functions and more general