If that's what you want.
Nick
[email protected]
Martin Weiss
loc absmax=max(`max', r(max))
at the end of your code to get this into a -local- then?
Nick Cox
Not the main point, perhaps, but there is a much more direct way to do
this.
sysuse auto, clear
su price, meanonly
local max = r(max)
su trunk, meanonly
di max(`max', r(max))
Martin Weiss
Well, -egen- does not take more than one variable because usually that
is
what users want: either the -max- of a variable or the max across
columns,
which -egen- also supports with the -rowmax- option. If you want the
maximum
of two vars for whatever reason:
sysuse auto, clear
tempvar prmax trmax overallmax
egen `prmax'=max(price)
egen `trmax'=max(trunk)
egen `overallmax'=rowmax(`prmax' `trmax')
su `overallmax',mean
loc max=r(max)
di in red `max'
Ashim Kapoor
On 2nd thought.
egen j=max(x) DOES NOT take more than one variable.
It is gen which can do the max of 2 or more variables.
So since egen returns a variable with ONE constant value, it would
seem that it should be allowed to be stored in a scalar / local
macro.
*
* 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/