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: RE: How to create sum of variables by time and space


From   "Ahmedov, Zafarbek" <[email protected]>
To   [email protected]
Subject   Re: st: RE: How to create sum of variables by time and space
Date   Wed, 8 Jun 2011 12:58:27 -0500 (CDT)

Dear Nick,

I tried "total(.)" but it didn't work with "by varlist:". I used the following code:

. sort location year month
. by location year month: total(Tons Number_of_Barges)

Do you have another suggestion? Thanks.

Zafar


----- Original Message -----
From: "Nick Cox" <[email protected]>
To: "[email protected]" <[email protected]>
Sent: Wednesday, June 8, 2011 12:39:40 PM GMT -06:00 US/Canada Central
Subject: st: RE: How to create sum of variables by time and space

. help egen 

Nick 
[email protected] 

Ahmedov, Zafarbek

I'm using Stata 11. I have a data table with 5 variables (columns)and over 500,000 observations. Two of them are time (Year, Month) variables and one location (Location) variable. I am trying to get the sum of the other two variables (Tons, Number_of_Barges) by location and time. 

I tried to sort the data and get the summary statistics, but it didn't produce the desired result. I typed the following codes:

sort location year month
by location year month: summarize(Tons Number_of_Barges)


The problem with this code is, it didn't give the totals. I would greatly appreciate if you can offer any help or advise.


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


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