# Re: st: re: Programming stata using egen functions

 From Anne Resende To statalist@hsphsun2.harvard.edu Subject Re: st: re: Programming stata using egen functions Date Tue, 28 Apr 2009 12:02:25 +0100 (BST)

```Hi
I am a beginner in stata programming but my aim is to create a “mean”
of the variable logwage to after run the bootstrap.
So when I use rowmax( )  I expect the program to calculate the maximum
of the value of the variables in parenthesis. For each `s’ I need the
maximum value between the `sp’ numbers.
For example: m_108 = 2.33
m_109 = 3.4
m_1010= 1.2
So I want the program to return de value 3.4. When I use the function
max the program returns me the value of m_1010 because it is
considering the max between the values 108, 109, 1010.
So after the program calculate the maximum value within it m_`s’`sp’ ,
I trying to use the rowtotal( ) to sum all of the maximum values and to
end up with just one variable.
Thanks
Anne

Kit Baum wrote:

><>
>egen rowmax() and rowtotal() are meant to be used with more than one
>variable (rather than a scalar) as an argument.
>
>     qui egen `exem_`s''=rowmax(m_`s'`sp')
>
>if m_`s'`sp' is a scalar, its rowmax or rowtotal is itself--a constant
>value for each row (observation). What are you trying to do?
>
>
>Kit Baum   |   Boston College Economics & DIW Berlin   |
http://ideas.repec.org/e/pba1.html
>                               An Introduction to Stata Programming
>|   http://www.stata-press.com/books/isp.html
>    An Introduction to Modern Econometrics Using Stata  |
http://www.stata-press.com/books/imeus.html
>
>
>
>*
>*   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/
>

*
*   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/
```