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 on April 23, and its replacement, is already up and running.

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

st: collapsing rows and generating new smaller dataset

From   Tim Evans <>
To   "''" <>
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

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

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:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index