I am not aware of an -rmean- command.
I take it this refers to the -egen-
function -rmean()-.
In essence given Stata at the moment
the most practical way to do it is
I guess the way you did it:
count the number of non-missing
first before calculating the row mean.
But doing it the SPSS way is programmable.
The Stata way might be to add an option
to a clone of -egen, rmean()-. This sort
of thing is like an itch: if there is
a Stata programmer who wants it enough,
they'll program it. Then you have a
solution comparable to that of SPSS.
Also, there is at least one one-line solution, but
you won't like it,
gen rmean = (
(var1 * !mi(var1)) +
(var2 * !mi(var2)) +
<and so on> +
(var8 * !mi(var8)) ) /
(!mi(var1) +
!mi(var2) +
<and so on> +
!mi(var8))
if
(!mi(var1) +
!mi(var2) +
<and so on> +
!mi(var8))
>= 6
However, I didn't test this.
In such a way any criterion of this
kind you like is manageable in principle. To my mind
egen robs = robs(var?)
egen rmean = rmean(var?) if robs >= 6
beats that code hands down.
Nick
[email protected]
Garrard, Wendy M.
> I need to compute average scale scores for individual records. The row
> means command [rmean] will do this, but I can't figure out how to
> specify minimum frequency criteria (e.g., compute an average
> score only
> if 6 or more columns have data) as part of the [rmean] command.
>
> For now I'm working around this by using [robs] to yield a second
> variable which, in turn, is used as the minimum criteria for
> the [rmean]
> calc.
>
> But, I suspect there is a simpler Stata solution that doesn't entail
> creating the extra [robs] variable. For example, in SPSS this would be
> done in one step by using [MEAN.6(var1 var2 var3 ... var8)].
> Can someone
> point me in the right direction?
>
*
* 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/