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: generating observations in data set


From   Tim Evans <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: generating observations in data set
Date   Thu, 7 Mar 2013 11:23:29 +0000

Hi all,

I am trying to calculate age standardised incidence rates using -distrate- which is a user written package (accessible by -ssc install distrate-) in Stata 11.2, but need help in order to identify where I have missing levels of data in my dataset.

I have 5 year age groups and am looking at type 1 and type 2 disease. For type 1 disease I have observations in every age group from 0-4 and 85+, but in type 2 disease there is an absence of observations in 0-4 and 10-14 age group. What I would like to do is evaluate whether there are any 'missing' observations and insert a row for that age group and set the number of observations to 0 - this may happen many times in my data as I have multiple years of data. My data look like this:

dis	yydx	age_grp	count
1	2003	0-4	321
1	2003	5-9	266
1	2003	10-14	201
1	2003	15-19	167
1	2003	20-24 150 
2	2003	5-9	266
2	2003	15-19	167
2	2003	20-24 100

I would like to be able to change it to this:

dis	yydx	age_grp	count
1	2003	0-4	321
1	2003	5-9	266
1	2003	10-14	201
1	2003	15-19	167
1	2003	20-24 150 
2	2003	0-4	0
2	2003	5-9	266
2	2003  10-14 0
2	2003	15-19	167
2	2003	20-24 100

Any help greatly appreciated.

Best wishes

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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index