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 on April 23, and its replacement, is already up and running.

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

Re: st: r(111) with egen count function

From   "Michael N. Mitchell" <>
Subject   Re: st: r(111) with egen count function
Date   Mon, 12 Jul 2010 07:43:45 -0700

Dear Elizabeth

Some functions in -egen- will accept a variable list, some will accept a variable, ans some will accept an expression, etc...

In the case of the rownonmiss() function, it will accept a varlist, and that it why that example works. But the -count()- function accepts only an expression, as noted in this snippet from the help file

 count(exp)                      (allows by varlist:)
            creates a constant (within varlist) containing the number of
            nonmissing observations of exp.  Also see
            rownonmiss() and rowmiss().

  I wonder if you really want the -rownonmiss()- function, which does accept a varlist?

I hope this helps,

Michael N. Mitchell
Data Management Using Stata      -
A Visual Guide to Stata Graphics -
Stata tidbit of the week         -

On 2010-07-12 7.36 AM, Elizabeth Allred wrote:
I just updated my ado files and am now having a problem with the -egen- function, -count-. Fortunately, -rownonmiss- works.

Stata 11.1 completely up-to-date on Windows.

. egen count1=count(saa1 saa2 saa3)
saa1saa2saa3 not found

. egen count2=rownonmiss(saa1 saa2 saa3)

. tab count2

      count2 |      Freq.     Percent        Cum.
           1 |         58        6.18        6.18
           2 |        187       19.91       26.09
           3 |        694       73.91      100.00
       Total |        939      100.00

*   For searches and help try:
*   For searches and help try:

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