Dear all,
Im rising a question again.I hope you understand as Im
new to Stata and Im learning. I want to create a
program that will calculate the proportion of women or
men as a moving average. This proportion will move per
month.
So basically the first proportion is the number of
women in my data would include months 1-12 for years
1,2,3. The second include months 2-12 for year 1 and
months 1-12 for years 2 and 3. The third would be the
proportion of women in months 3-12 for year 1 and
months 1-12 for year 2 and 3. Etc...
I have 60,000 observations and looks like:
list month year female male sex_unknown
+-----------------------------------------+
month year female male sex_un~n
-----------------------------------------
1. 7 2005 0 0 1
2. 9 2004 0 0 1
3. 6 2006 0 0 1
4. 3 2005 0 0 1
5. 9 2005 0 0 1
-----------------------------------------
6. 5 2005 0 0 1
7. 1 2006 0 1 0
8. 4 2004 0 0 1
9. 3 2005 0 0 1
10. 8 2003 0 1 0
-----------------------------------------
11. 11 2003 0 1 0
12. 11 2005 0 0 1
13. 8 2006 0 0 1
14. 6 2005 0 0 1
15. 10 2006 0 0 1
-----------------------------------------
16. 9 2005 0 1 0
17. 7 2005 0 0 1
18. 5 2003 0 1 0
19. 3 2004 0 0 1
20. 12 2004 0 1 0
Im trying to do a simple program like this:
______________________________________
program mvafemale
version 9.2
proportion female if month==1-12 & year==2003-2006,
over(year)
.....// I want to calculate the proportion for all
moving average months
end
mvafemale
_________________________________________
However, when I calculate the first proportion it says
that there are no observations. I have tried a few
other versions but got stuck.
Can anyone recommend me something?
Thanks in advance,
regards,
Gaby
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/