| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: conceptual question regarding -egen-
Daniel,
You are correct about what egen does, but you should be able to do what
you want to do using summarize and return. See -help return-
Rose
daniel waxman wrote:
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/
--
Rose Anne Medeiros
Department of Sociology / Family Research Laboratory
University of New Hampshire
126 Horton Social Science Center
20 College Road
Durham, NH 03824
U.S.A.
*
* 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/