.-
help for ^rprod^                                                    
.-
.
Calculating the row product of observations
-------------------------------------------
.
  ^egen^ newvar ^=^ ^rprod(^varlist^)^ [^if^ exp] [^in^ range]
                     [^, pm^iss^(ignore^|^missing^|^1)^]
.
.
Description
-----------
.
^rprod^ provides a multiplicative row function for ^egen^ analogous to the
additive ^rsum^ function.  The product of observations of <varlist>
meeting optional ^in^ and ^if^ conditions is returned in <newvar>. ^rprod^
insists that <newvar> is calculated in double precision.
.
.
Option
------
.
^pm^iss^(ignore|missing|1)^ specifies what is to be the product of a group
    at least one of whose observations is missing.  This is to maintain 
    consistency with another ^egen^ function, ^prod^.
.
   ^pm^iss^(ignore)^, the default, ignores missing values and returns the
        product of all non-missing values in the group. If all values are
        missing, then missing is returned.
.
   ^pm^iss^(missing)^ returns missing for the product of observations in
        a group if any observation in the group is missing.
.
   ^pm^iss^(1)^ returns 1 for the product of observations in a group
        if all observations in the group are missing. Otherwise it
        returns the product of all non-missing values. This choice would
        rarely be made (see Appendix in STB-51 insert for ^_gprod^).
.
.
Examples
--------
.
^. list a b c^

a b c 1. 1 1 1 2. 2 3 4 3. 0 1 5 4. 5 0 1 5. 0 0 0 6. . . . 7. 1 . 1 8. 8 3 . 9. 0 . 0 10. . 0 . 11. . . 0 12. . . 6 13. -3 4 5 14. -1 -7 2 15. . . -4

^. egen k = rprod(a b c )^ (1 missing value generated)

^. list^

a b c k 1. 1 1 1 1 2. 2 3 4 24 3. 0 1 5 0 4. 5 0 1 0 5. 0 0 0 0 6. . . . . 7. 1 . 1 1 8. 8 3 . 24 9. 0 . 0 0 10. . 0 . 0 11. . . 0 0 12. . . 6 6 13. -3 4 5 -60 14. -1 -7 2 14 15. . . -4 -4

^. egen m = rprod(a b c ), pmiss(missing)^ (8 missing values generated)

^. list^

a b c k m 1. 1 1 1 1 1 2. 2 3 4 24 24 3. 0 1 5 0 0 4. 5 0 1 0 0 5. 0 0 0 0 0 6. . . . . . 7. 1 . 1 1 . 8. 8 3 . 24 . 9. 0 . 0 0 . 10. . 0 . 0 . 11. . . 0 0 . 12. . . 6 6 . 13. -3 4 5 -60 -60 14. -1 -7 2 14 14 15. . . -4 -4 .

Author ------

Philip Ryan Department of Public Health University of Adelaide South Australia philip.ryan@@adelaide.edu.au . . Also see -------- . Manual: [R] ^egen^ STB-51: ^_gprod^ On-line: help for ^egen^ ^prod^