I am fairly new to STATA, and need to create a moving average for my data. (I cannot use tsset for this data). I am trying to do something like:
gen ma = education if year==19301 + education if year==19302 + education if var==19303 + education if year==19304 / 4
(So i have four years of data I need to find the average of)
I have 40 years of data, and I don't mind if I set up the moving average equation 40 times, but I can't get any form of equation to work.
I am doing a moving average of education by year. How can I do this? Thanks!
Related Posts with gen mean with if statements
Penalized Quasi-Likelihood for Mixed linear modelIs it possible to use Penalized Quasi-Likelihood estimation for GLMM model ? I found the meglm glm a…
xtset an tssetHi! For the construction of a certain variable, I have to do following calculation: Code: generate…
sort may not be combined with byHi, Using the below current code, I could generate my desired output. That is the 95% credible inter…
Testing instrument validity - ordered probitHi, I am looking at the relationship between financial inclusion and poverty. my dependent variable…
graph bar with controlsHello - For a paper submission, I want to display a graph bar after a multivariate linear regression…
Subscribe to:
Post Comments (Atom)
0 Response to gen mean with if statements
Post a Comment