Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Re: AW: egen rowmeaan

From   Dirk Enzmann <>
Subject   st: Re: AW: egen rowmeaan
Date   Thu, 05 Aug 2010 02:29:11 +0200

"Dr. Martin Weiss" <> wrote:

Probably two steps are necessary:


That's (among others) why I wrote -scores-:

* ------------------------------------------
which scores
if _rc ssc install scores

set obs 100

foreach var of newlist var1-var10{
	gen `var'=  cond(runiform()>.5,.,2)

* Version 1:
egen float rownonmissings = rownonmiss(var*)
egen float rowmean = rowmean(var*) if inrange(rownonmissings,7,.)
drop rownonmissings

* Version 2:
scores rowmean2 = mean(var*), nv(7)

* Check:
sum rowmean rowmean2
* ------------------------------------------

Dr. Dirk Enzmann
Institute of Criminal Sciences
Dept. of Criminology
Rothenbaumchaussee 33
D-20148 Hamburg

phone: +49-(0)40-42838.7498 (office)
       +49-(0)40-42838.4591 (Mrs Billon)
fax:   +49-(0)40-42838.2344
*   For searches and help try:

© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index