Hello, I have been receiving great help from the Stata Forum by searching - but today I have encountered a problem which I don't even know how to put keyword for the search. I would appreciate it very much if you could please help me on this.

My data looks like this
id ts1 ts2 ts3 ts65 tact1 tact2 tact3 …. tact65
1 1 4 5 75 111 121 234 111
2 1 3 6 80 111 131 313 111
3 1 4 5 90 111 141 123 111
ts* is time slot - so 1 means the first slot, so ts2=4 means 4th slot.
tact* is the activity that was performed on that slot.

I need to make variables called act* based on the value of time slots and tact.
I need to make activity variables corresponds to the time slot.

For instance, this is what I need to make from the above dataset:
id act1 act2 act3 act4 act5 act6 act144
1 111 111 111 121 234 234
2 111 111 131 131 131 313
3 111 111 111 141 123 123
But I don't know how to make act* based on the value of the ts*

I tried forvalues, but wasn't able to figure it out how to create proper loop.
I don't even know how to explain this in sentence - I am sorry if my explanation doesn't make much sense.
I would appreciate any help you could give..Thank you so much.