Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

RE: st: best way to add up values sorted by a unique id


From   "Özlen D. Luznar" <ozlend1@umbc.edu>
To   statalist@hsphsun2.harvard.edu
Subject   RE: st: best way to add up values sorted by a unique id
Date   Thu, 24 Jun 2010 18:40:05 -0400 (EDT)

thanks again martin.  I found nick's faq a little late but I will take
your suggestion below too.  thanks so much.
>
> <>
> Try NJC`s http://www.stata-journal.com/sjpdf.html?articlenum=pr0004 as
> well.
> Sometimes you will need to use -bysort- instead of a mere -by-.
>
>
> HTH
> Martin
>
>
> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Richard
> Goldstein
> Sent: Donnerstag, 24. Juni 2010 22:32
> To: statalist@hsphsun2.harvard.edu
> Subject: Re: st: best way to add up values sorted by a unique id
>
> egen annfaminc=total(totalincome), by(unifam)
>
> Rich
>
> On 6/24/10 4:25 PM, Özlen D. Luznar wrote:
>> Hi everyone,
>>
>> I have a dataset where I am trying to calculate total family income
>> identified by a unique family id "unifam".  Each person in the unifam
>> has
>> a totalannual income and I am trying to add totalannual income to
>> calculate annual family income - at the unifam level.
>>
>> For example
>>
>> unifam==1  person=1 totalincome == 60
>> unifam ==1 person=2 titalincome == 40
>>
>> unifam=1  totalfamilyincome == 100
>>
>> unifam ==2 person=1 totalincome = 100
>> unifam==2 person=2 totalincome= 50
>> unifam =2 person=3 totalincome =50
>>
>> unifam =2 totalfamilyincome ==200
>>
>> Thanks!
>>
>>
> *
> *   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/
>
>


-- 
Özlen D. Luznar

PhD Candidate - Public Policy
Graduate Research Assistant
University of Maryland Baltimore County (UMBC)
1000 Hilltop Circle
Baltimore, MD 21250

443-846-5010

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index