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]

From |
Christophe Kolodziejczyk <[email protected]> |

To |
[email protected] |

Subject |
Re: st: How to find the sum of a variable by a group id |

Date |
Tue, 2 Aug 2011 18:09:11 +0200 |

write instead collapse (sum) y1, by(hhid) Christophe 2011/8/2 Urmi Bhattacharya <[email protected]>: > Dear Statalisters, > > I have the following data set. > > hhid childid y1 > 1 1 1 > 1 2 1 > 1 3 0 > 2 1 0 > 2 2 0 > > > I need to find the sum of y1 per hhid, i.e., i need to get the > following data set > > hhid sumy1 > 1 2 > 2 0 > > How do I get that? > > I tried the following > > collapse (sum) y1, by hhid > it gives me the following error: > > option by incorrectly specified > r(198); > I am using Stata 11.2. > > It is a simple enough thing I am sure, but I am just not able to work > it out. It would be great if someone could tell me where am i going > wrong? > > Best > > Urmi > * > * 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/

**Follow-Ups**:**Re: st: How to find the sum of a variable by a group id***From:*Billy Schwartz <[email protected]>

**References**:**st: How to find the sum of a variable by a group id***From:*Urmi Bhattacharya <[email protected]>

- Prev by Date:
**st: How to return regression results from a complex column vector in mata back to stata** - Next by Date:
**st: Endogeneity in Frontier Model** - Previous by thread:
**st: How to find the sum of a variable by a group id** - Next by thread:
**Re: st: How to find the sum of a variable by a group id** - Index(es):