Hi All,

I'm trying to find a way of generating variable names automatically.

I have a list of share prices: share1, share2, ...., share12. I want to compute returns in a loop. Here is what I was doing:
# Compute returns for all shares
loop foreach i list_share
        ret_$i = 100 * (log(list_share.$i) - log(list_share.$i(-1)))
endloop

The above one would return the following variables: ret_share1, ret_share2,..., ret_share12.

My question is simple: is there a way of controlling the name of the output variable in a different way than what is used above? I mean, how can I get output in variables with name: ret1, ret2,..., ret12? Is there any sequential command that can be added to ret*?

Thanks.
--
Filipe Rodrigues da Costa
Send me an email to: filipe@pobox.io
Reach me through Telegram at: https://t.me/rodriguesdacosta