What is your issue with drop table statement?
I had a problem wit it too, but I resolved. My problem was that at the end of the script not all table were dropped.
After tests and retest, I undertood that, during dropping, the 'TableNumber' of existing table change!! So, if for example the number of "TableX" at the beginning is 15, during dropping can change in 10, 5,0...and when the n of your FOR is 15, the function "tablename(15)" is null.
Then I revolved using a different approach...not a cycle, but a long string.
FOR i = 0 to NoOfTables()-1
LOAD TableName($(i)) as Tablename AUTOGENERATE 1
WHERE not WildMatch(TableName($(i)), 'TableA','TableB','TableC');
load concat(Tablename, ',') as Tablename1
let vdrop= peek('Tablename1');
DROP Tables TableList,TableList1;
DROP Tables $(vdrop);
I hope this can help you.