Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: conceptual question regarding -egen-


From   "daniel waxman" <[email protected]>
To   <[email protected]>
Subject   st: conceptual question regarding -egen-
Date   Mon, 6 Feb 2006 13:48:22 -0500

If one performs -egen- across the entire dataset rather than -,by()- then it
returns what is essentially the same scalar for every observation.

Is there any way to actually generate a scalar rather than a variable?
For example, I am interested in having a scalar or local macro which
contains the largest value of either of two variables

i.e. 

. egen maxmort = max(p_pred_mort)
. egen predmort = max(p_act_mort)

. local maxmax = max(maxmort, predmort)
. drop maxmort predmort

I know that bytes are cheap these days, but it seems odd that I have to
generate 100,000 of each of these values when I only need one.  Or do I have
major conceptual issues?


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



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index