Dear community, I would like to iteratively select column values (nobs) into individual variables (count): nobs value of row 1 into count1, nobs value of row 2 into count2, and so on. I used a do loop for the iteration and added a column "index" to the dataset so as to help select the specific row for each iteration, using a where clause, below is the code: %macro sqlloop(start=,end=);
proc sql;
%do i=&start. %to &end. %by 1;
select nobs
into :count
from table
where index=i;
%end;
quit;
%mend;
%sqlloop(start=1, end=5) I got the error : ERROR: Expression using equals (=) has components that are of different data types, for the where index=i clause even if the index column is numeric and i also. If I replace i by 1 in the code, there is no error but then there is of course no iteration through the rows. Plus, I do not know how iteratively adapt the variable name count for each iteration (count1, count2, count3 and so on.) Could you please help ? Thanks
... View more