added stack overflow version of making panel data set