# Re: st: RE: How to find Max value.

 From Rijo John To Statalist Subject Re: st: RE: How to find Max value. Date Sat, 19 Jun 2004 23:36:19 +0530 (IST)

```One simple solution would be, I think, to use the egen command with the
max option. for example

egen maxval=max(mf) if temp==26, by(time)
This will generate a new variable with the max of mf. then  may be you can
give a count command (again using egen) and get the percentages.....

Nevertheless there may be easier ways to do this also....

Rijo M John.

On Sat, 19 Jun 2004, Syed O Masood wrote:

:I have put a piece of data below.
:I need to find what percent of people have maximum
:value in the variable rf at time 1 and temp 26, what
:percent of people will have maximum value of mf at
:time 2 and temp 26, what percent of people have max
:value of mf at time 3 and temp 26 and similarly for
:tmep 35oC.
:
:
:. list temp time mf
:
:     +---------------------+
:     | temp   time      mf |
:     |---------------------|
:  1. |   26      1     5.5 |
:  2. |   26      2    8.64 |
:  3. |   26      3   12.03 |
:  4. |   35      1    8.64 |
:  5. |   35      2    5.59 |
:     |---------------------|
:  6. |   35      3    9.02 |
:  7. |   26      1    3.88 |
:  8. |   26      2    8.63 |
:  9. |   26      3   10.35 |
: 10. |   35      1    8.34 |
:     |---------------------|
: 11. |   35      2   10.22 |
: 12. |   35      3   11.25 |
: 13. |   26      1    3.29 |
: 14. |   26      2    6.12 |
: 15. |   26      3    7.37 |
:     |---------------------|

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