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
iroc does not workDear all, I am running a small logistic regression but I am not getting any value when I type "iroc…
Stata manual for -ml- does not explain what -gtol()- refers toDear Statalisters, I have seen commands in -ml- that use as an option -gtol()-. For example, in thi…
ML command could not find feasible valuesDear STATA experts: I’m learning STATA's maximize likelihood syntax by building my own ordered prob…
inquire about preserve and restoreI need to drop tons of variables in my data set for panel A task. And I need to go back to the origi…
help with installing -listcoef- to Stata13Hi, I have stata13 on my computer and I typed -findit listcoef- in the stata window. I see the optio…
Subscribe to:
Post Comments (Atom)
0 Response to gen mean with if statements
Post a Comment