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]

st: collapsing rows and generating new smaller dataset


From   Tim Evans <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: collapsing rows and generating new smaller dataset
Date   Fri, 8 Jun 2012 10:47:27 +0100

Hi all,

I have a dataset in Stata 11.2 that contains the following:


age_grp	f_pop	m_pop	tot_pop
40-44		7000	7000	14000
45-49		7000	7000	14000
50-54		7000	7000	14000
55-59		6000	6000	12000
60-64		5000	5000	10000
65-69		4000	4000	8000
70-74		3000	3000	6000
75-79		2000	2000	4000

What I want to do is collapse this down so that I have the following three categories which have the sum of each level of age-grp:

age_grp2	f_pop m_pop tot_pop
40-49
50-69
70-79

What I would like to know is how I can collapse the above, but sum the populations of each variable.

I.e 40-49 for f_pop will be the sum of 40-44 and 45-49 and so on.

Any ideas appreciated

Tim
_DISCLAIMER:
This email and any attachments hereto contains proprietary information, some or all of which may be confidential or legally privileged. It is for the exclusive use of the intended recipient(s) only. If an addressing or transmission error has misdirected this e-mail and you are not the intended recipient(s), please notify the author by replying to this e-mail. If you are not the intended recipient you must not use, disclose, distribute, copy, print, or rely on this e-mail or any attachments, as this may be unlawful.


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