Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: Beginner Q: 7mil obs - how to add variables


From   "Coleman, Greg" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   RE: st: Beginner Q: 7mil obs - how to add variables
Date   Tue, 8 Oct 2013 19:25:44 +0000

Thanks.
That just gives me this:


. egen newvar=total(distance), by(tailnum)

. display newvar
149899

Distance flown by airplane with tail number XXXXXX

I am trying to eventually graph the top N planes by distance flown.

I am getting close (I think) to understanding some features, I can see this:

. bysort tailnum: sum distance

----------------------------------------------------------------------------------------------------------------------
-> tailnum = 80009E

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
    distance |      1959    452.6514    216.5128         56       1194

----------------------------------------------------------------------------------------------------------------------
-> tailnum = 80019E

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
    distance |      1906    446.2739    222.8244         56       1149


But need the arithmetic sum of all the distances for each tailnumber.

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Richard Goldstein
Sent: Tuesday, October 08, 2013 3:01 PM
To: [email protected]
Subject: Re: st: Beginner Q: 7mil obs - how to add variables

not completely clear, but it looks like this will get you what you want:

egen newvar=total(Value), by(String)

Rich

On 10/8/13 2:46 PM, Coleman, Greg wrote:
> Hi 
> My data has 7 million observations and 29 variables. About 10 of the variables are string, and I am trying to get some patterns of the numerical values which are related to the strings. To clarify, 
> 
> String                    Value
> AB1234                 25
> CDE789                 44
> F9999                    126
> CDE789                 10
> AB1234                 3
> F9999                    100
> 
> I would like to get output that looks like the sum of values, per string:
> AB1234 28
> CDE789 54
> F9999 226
> 
> Some strings are just numbers, some are just letters, and some are a combination. 
> Can anyone assist?
> Thanks!
> Greg
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index