So basically I want to use the prior and prior prior values as my features for my label which is the same value, y. I've changed the data into what I think is easiest to understand. I done something like this in Python, but not sure how to in SAS. Any code on how to change the have dataset into the want dataset would be much appreciated! data have; infile datalines delimiter=','; input id $ y year 8.; datalines; 1,20,2016 1,10,2015 1,5,2014 2,60,2016 2,30,2015 2,15,2014 3,36,2016 3,18,2015 3,9,2014 ; data want; infile datalines delimiter=','; input id $ y year lag_1_y lag_2_y 8.; datalines; 1,20,2016,10,5 1,10,2015,5,. 1,5,2015,.,. 2,60,2016,30,15 2,30,2015,15,. 2,15,2014,.,. 3,36,2016,18,9 3,18,2015,9,. 3,9,2014,.,. ;
... View more