Hi everyone.
I have a dataset with this structure:
date a1 a2 a3 a4 a5 example example_bis
01/01/2010 0,964544 0,299779 0,838325 0,588524 0,601897 a1
02/01/2010 0,199131 0,169002 0,739159 0,601027 0,432588 a1 a1_2
03/01/2010 0,093236 0,456162 0,329516 0,555676 0,704005 a1 a1_3
04/01/2010 0,998163 0,75575 0,851664 0,905683 0,466822 a2
05/01/2010 0,23161 0,423221 0,53578 0,949554 0,010081 a2 a2_2
06/01/2010 0,499233 0,098404 0,780413 0,44331 0,336991 a3
07/01/2010 0,640499 0,746181 0,665035 0,330106 0,88336 a4
08/01/2010 0,877551 0,872349 0,249145 0,833043 0,680223 a4 a4_2
09/01/2010 0,261664 0,88268 0,468992 0,138262 1,45E-05 a4 a4_3
10/01/2010 0,075544 0,025913 0,263116 0,642657 0,604153 a4 a4_4
11/01/2010 0,697504 0,477392 0,918613 0,824546 0,775222

I would like to create a loop which permits me to create some columns in this way:

date a1 a1_2 a1_3 a2 a2_2 a3 a4 a4_2 a4_3 a4_4 a5 example example_bis
01/01/2010 0,964544 0,964544 0,964544 0,299779 0,299779 0,838325 0,588524 0,588524 0,588524 0,588524 0,601897 a1
02/01/2010 0,199131 0,199131 0,199131 0,169002 0,169002 0,739159 0,601027 0,601027 0,601027 0,601027 0,432588 a1 a1_2
03/01/2010 0,093236 0,093236 0,093236 0,456162 0,456162 0,329516 0,555676 0,555676 0,555676 0,555676 0,704005 a1 a1_3
04/01/2010 0,998163 0,998163 0,998163 0,75575 0,75575 0,851664 0,905683 0,905683 0,905683 0,905683 0,466822 a2
05/01/2010 0,23161 0,23161 0,23161 0,423221 0,423221 0,53578 0,949554 0,949554 0,949554 0,949554 0,010081 a2 a2_2
06/01/2010 0,499233 0,499233 0,499233 0,098404 0,098404 0,780413 0,44331 0,44331 0,44331 0,44331 0,336991 a3
07/01/2010 0,640499 0,640499 0,640499 0,746181 0,746181 0,665035 0,330106 0,330106 0,330106 0,330106 0,88336 a4
08/01/2010 0,877551 0,877551 0,877551 0,872349 0,872349 0,249145 0,833043 0,833043 0,833043 0,833043 0,680223 a4 a4_2
09/01/2010 0,261664 0,261664 0,261664 0,88268 0,88268 0,468992 0,138262 0,138262 0,138262 0,138262 1,45E-05 a4 a4_3
10/01/2010 0,075544 0,075544 0,075544 0,025913 0,025913 0,263116 0,642657 0,642657 0,642657 0,642657 0,604153 a4 a4_4
11/01/2010 0,697504 0,697504 0,697504 0,477392 0,477392 0,918613 0,824546 0,824546 0,824546 0,824546 0,775222
where a1_2, a1_3 are equal to a1 and so on.
The idea is to create a column each time "example_bis" contains a different value of variable "example". The new column has to contain the same data of column named as the content of "example".

Can you please help me to implement a loop to do so?

Thank you very much

Andrea