What kind of model? Some of the time-series procedures are set up to handle such internally. I suggest providing much more detail about what you are attempting. I mention time-series because your question included "Do the original dates need to be modified as the dates" and there is no indication as to where such dates might reside.
I also think that your "example" is incorrect. I would expect something more like:
Obs |
X |
Y |
Lag1_Y |
1 |
x1 |
y1 |
|
2 |
x2 |
y2 |
y1 |
3 |
x3 |
y3 |
y2 |
4 |
x4 |
y4 |
y3 |
5 |
x5 |
y5 |
y4 |
6 |
x6 |
y6 |
y5 |
Also if there are ANY other variables in your model then how they are used might have an impact on how the Lags are calculated. For example if one variable indicates a geography, product or other grouping variable (typically a CLASS variable in SAS) then you likely do not want the lagged value from a different group to be included.
@mike111111 wrote:
I am new to SAS and have a question for help. Here is the simplified question.
I am looking X effect on Lagged Y, let's say Lag1_Y=k*X +c. There are total 6 observations of "X" and "Y".
Obs |
X |
Y |
Lag1_Y |
1 |
x1 |
y1 |
|
2 |
x2 |
y2 |
y2 |
3 |
x3 |
y3 |
y3 |
4 |
x4 |
y4 |
y4 |
5 |
x5 |
y5 |
y5 |
6 |
x6 |
y6 |
y6 |
I lagged variable "Y" and get 5 observations for "Lag1_Y". Now the effective observation pairs are 5:
1 x1 y2
2 x2 y3
3 x3 y4
4 x4 y5
5 x5 y6
How should I use the lagged variable in model? Do the original dates need to be modified as the dates shown in lower portion before regression analysis? I appreciate your help in advance