Dear Stata community,

My data is panel data, and the independent variable is available only in the last year, so it's time invariant. In order to mitigate against the potential problem of life cycle effects influencing the independent variable, I have to condition it Tj on a polynomial in age A, i.e. Tj = hjA + ej. The resulting residuals are standardised and used as indicators of independent variable net of life cycle influences. The following is my code, is it right? I couldn't be more appreciate if you can give me details.

Code:
reg Openness age
predict r_O, res
norm r_O,method(zee)