Hi, I have weekly data, with each week of every year having a variable (first six week of 2012 shown in example, however my dataset covers multiple years). I've made a variable "begin" which indicates when each individual was assigned to treatment. My goal is to create a dataset showing the first 50 weeks of treatment for each individual. Week1 should equal y_1203 (=100) for ID=1, y_1201(=300) for ID=2 and so on. I've have tried multiple variations of arrays, however I cannot seem to get it right. Is there any way to begin the array at the variable equal to the value of "begin" for each ID? Example of data: ID y_1201 y_1202 y_1203 y_1204 y_1205 y_1206 begin 1 100 100 100 200 200 200 y_1203 2 300 100 100 300 200 200 y_1201 Goal example (only first 6 weeks shown here): ID week1 week2 week3 week4 week5 week6 1 100 200 200 200 . . 2 300 100 100 300 200 200 Thanks for helping!
... View more