Hey there,

I have problems with creating a loop on two dependent variables for my bond prices. For each bond I have two daily changing variables. On the one hand, I do have the sums of the daily returns and on the other hand I have the amount of trading days, the bond is already active.
My goal is to create a new variable for each bond which divides the trading days through the daily returns in every column.

How can I do that through a loop ?

For example,


bond x bond y
sum daily returns trading days sum daily returns/trading days sum daily returns trading days sum daily returns/trading days
0,025 501 0,025 / 501 0,001 651 0,001 / 651
0,05 502 0,05 / 502 0,002 652 0,002 / 652
...

For sure, the amount of columns is not just two, its many thousands..


Many thanks in advance,

Best regards
Freddy