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: how to summarize while accounting for duplicate values


From   dstahler@ucla.edu
To   statalist@hsphsun2.harvard.edu
Subject   RE: st: how to summarize while accounting for duplicate values
Date   Sat, 20 Feb 2010 06:25:58 -0800

Thank you to those who suggested using egen and using the first record for an individual.

Best,

Dan


Quoting Martin Weiss <martin.weiss1@gmx.de>:


<>

If this is indeed Dan`s intent, he may also like -egen, tag()-.


HTH
Martin

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Jeph Herrin
Sent: Samstag, 20. Februar 2010 04:19
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: how to summarize while accounting for duplicate values


If your individuals are identified by the variable -id-,
then create an indicator for one record per -id-:

   bys id: egen first=_n==1

Then all you have to do is condition on -first-

  sum birthday if first

to get summary stats on one record per individual.

hth,
Jeph



dstahler@ucla.edu wrote:
I am trying to summarize a dataset in Stata 10.1 on individuals'
reproductive success throughout their life. The database is set up with
each individual having an annual entry with multiple variables. Some
variables' values change annually (e.g. # offspring born), while other
variables have duplicated values for each year as they do not change
over the course of their life (e.g. age of first reproduction,
lifespan). How do I get Stata to provide summary statistics for chosen
variables of interest in the population that accounts for individuals'
duplicated values for some variables that don't change annually?

Thanks in advance for your help.

Dan



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

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




--
Daniel R. Stahler, PhD Candidate
Department of Ecology and Evolutionary Biology
University of California, Los Angeles
621 Charles E. Young Dr. So.
Los Angeles, CA 90095-1606
(310)825-5014

and

Yellowstone Gray Wolf Recovery Program
Yellowstone Center for Resources
National Park Service
*
*   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