I need to delete a series inside a loop. Is there a way to do this? What I am doing is loading  data on a country, process the data, save some results, replace the data with the next country’s in my data set. Below is my code that does not work:


loop i = 1..numcountry

    cc = strsplit(ccode,i)

    append "@datafile.xlsx" --time-series --sheet="@cc" --coloffset=0 --rowoffset=1


#Do some stuff


    delete Q* # yields an error

    delete R* # would yield an error if previous line did not

end loop


This of course yields the error:


You cannot delete series in this context


I understand that delete does not work in a loop, but is there a work around? Or a better way to handle repeated processes?