# Re: st: Re: saving memory local vs usual variable

 From "Ashim Kapoor" <[email protected]> To [email protected] Subject Re: st: Re: saving memory local vs usual variable Date Fri, 3 Oct 2008 22:12:01 +0530

```so lets say we have

list
1
1
1
2
2
3

Then the 1st mode =1
2nd most freq obs = 2nd mode = 2
3rd mode = 3.

Please note I have no formal training in statistics so I may be wrong
but I think this is what it means.

so I would say

egen j=mode(list),numode(2)

to populate j with the 2nd mode ie. 2 in this case.

so how would I do this ? Which summary statistic refers to the mode.
And I am still puzzled as to why someone would not allow us to set
local  j=max(list)
cos that seems intuitive.

Thank you,
Ashim.

On Fri, Oct 3, 2008 at 9:59 PM, Martin Weiss <[email protected]> wrote:
> Anything that -su-, possibly with the -detail-, option throws up can be
> strored this way.
>
>                 r(N)
>             r(sum_w)
>              r(mean)
>               r(Var)
>                r(sd)
>          r(skewness)
>          r(kurtosis)
>               r(sum)
>               r(min)
>               r(max)
>                r(p1)
>                r(p5)
>               r(p10)
>               r(p25)
>               r(p50)
>               r(p75)
>               r(p90)
>               r(p95)
>               r(p99)
>
>
> Apart from that, also note commands like -collapse-...
>
> BTW, what is the second mode?
>
> HTH
> Martin
> _______________________
> ----- Original Message ----- From: "Ashim Kapoor" <[email protected]>
> To: <[email protected]>
> Sent: Friday, October 03, 2008 6:21 PM
> Subject: Re: st: Re: saving memory local vs usual variable
>
>
>> Yes I see that. Quite clever. BUT what if it is something which is NOT
>> generated by a summary statistic . Like say the 2nd mode  ( assuming a
>> variable has 2 modes). Can I directly store it into a local variable ?
>>
>> Thank you,
>> Ashim.
>>
>> On Fri, Oct 3, 2008 at 9:29 PM, Martin Weiss <[email protected]> wrote:
>>>
>>> As we said this morning:
>>>
>>> su age,mean
>>> loc lj=r(max)
>>>
>>> HTH
>>> Martin _______________________
>>> ----- Original Message ----- From: "Ashim Kapoor" <[email protected]>
>>> To: <[email protected]>
>>> Sent: Friday, October 03, 2008 5:54 PM
>>> Subject: st: saving memory local vs usual variable
>>>
>>>
>>>> Hello everyone,
>>>>
>>>> I have a question. Suppose I have a variable say - > age. Now I can do
>>>> egen j=max(age). Then I will have the max value of age in ONE
>>>> VARIABLE! Horrible waste of memory. I try to do local lj=max(age) and
>>>> that does not work. How can I conserve memory ? Is there something
>>>> basic which I have missed ?
>>>>
>>>> Thank you,
>>>> Ashim.
>>>>
>>>> PS : I do understand that I can do egen j = max (age ) and then say
>>>> local lj=j[1] and then -do drop j - but is there a better way ?
>>>> *
>>>> *   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/
>>>
>> *
>> *   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/
>
*
*   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/
```