Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
Nick Cox <n.j.cox@durham.ac.uk> |

To |
"'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: RE: How to create sum of variables by time and space |

Date |
Wed, 8 Jun 2011 19:07:50 +0100 |

I didn't suggest that you typed that. I suggested that you read the help for -egen-. Both syntax and examples show that you need to specify the -egen- command and also that you can only work on one variable at a time, for example bysort location year month : egen total_tons = total(tons) Your aim is to "get the summary statistics", which leaves lots of scope for doing that in different ways. Other commands that might be what you want include -collapse- and -tabstat-. Nick n.j.cox@durham.ac.uk Ahmedov, Zafarbek 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. From: "Nick Cox" <n.j.cox@durham.ac.uk> . help egen 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/

**Follow-Ups**:**Re: st: RE: How to create sum of variables by time and space***From:*"Ahmedov, Zafarbek" <zafar_ahmed@neo.tamu.edu>

**References**:**Re: st: RE: How to create sum of variables by time and space***From:*"Ahmedov, Zafarbek" <zafar_ahmed@neo.tamu.edu>

- Prev by Date:
**Re: st: RE: How to create sum of variables by time and space** - Next by Date:
**st: Error message with predictnl** - Previous by thread:
**Re: st: RE: How to create sum of variables by time and space** - Next by thread:
**Re: st: RE: How to create sum of variables by time and space** - Index(es):