In the table, TableIn, there is a variabel, Choice, that can take any of the 20 character values A - T.
Depending on the value of Choice I want to create 20 different smaller tables.
If the macro code looks something like this:
%DO i=1 %TO 20;
Pseudocode: IF Choice nr i THEN OUTPUT TableOut&i.;
This is a simple description of a more complicated situation.
In my real case I REALLY WANT to use a macro with a do loop, although it's not necessary in my example.
Is there any way inside the data step to check the value of i?
Since you don't really describe the relation between Choice and how this value affects the creation of the 20 tables, it's hard to give a qualified answer. But on your direct question: yes, &i is available in the data step. So your pseudo code should work. Macro variables are evaluated at data step compile time, which will in your case since your %do-loop wraps around a complete data step.