I am trying to calculate an average hours worked across 48 months for each observation using egen rmean(hours1....hours48). I discovered that while this works as long as a person has a positive hours across 2 or more months, for someone with positive hours on ONLY 1 month, the result for the average hours variable for that observation is a 0.
I thought egen rmean counts only columns with data and ignores columns with missing or 0 values so that if obs 2 exhibits the data pattern below,
obs month1 month2 month3 month4........month48 average48
1 20 . 14.75 .......(missing or 0).. 17.37
2 . . 32 ........(missing or 0).. 32
the average48 for that person reflects the single month for which there is positive hours worked.
Is there away to correct this situation so that egen rmean would divide an observation with only one month of data by 1 ?
Thanks
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/