Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

st: Creating a dummy set of values to use in a graph in the presence of under-reported values

From   Tim Evans <>
To   "''" <>
Subject   st: Creating a dummy set of values to use in a graph in the presence of under-reported values
Date   Fri, 29 Jun 2012 09:43:58 +0100

Hi all,

I am plotting incidence of a type of cancer by year and by sex between 1985 and 2009 in Stata 11.2. Between 1990 and 1994 I have a lot of missing data, and so the incidence appears to fall, even though the overall trend is going up. What I would like to do is generate a dummy data series with values that are based upon the difference in rates between the last full year of data before the missing data and the first year of full data following reinstatement of full data capture and then use these data to be able to plot in my twoway graph. So for instance, if I had 5 years missing data, and the rate increased by 10 from the two points either side of the missing data, I could generate dummy values which increase in increments of 2 per year.

I always know when the missing years of data are.

Alternatively, I could try and overlay a single line between the two points in my graph - but I don't know how I might do this. 

My data structure are as follows:

yydx sex crude_rate
1988 m   100
1989 m   110
1990 m   30
1991 m   35
1992 m   36
1993 m   36
1994 m   36
1995 m   120
1996 m   130
1997 m   136
1988 f   200
1989 f   210
1990 f   130
1991 f   135
1992 f   136
1993 f   136
1994 f   136
1995 f   220
1996 m   230
1997 m   236

I am graphing the data like this:

su crude if sex==`l'
line crude yydx if sex=="m", lpattern("l") || line crude yydx if sex=="f",  lpattern("_") xaxis(1 2) ,  /*
*/ yscale(range(`= 50 * ceil(r(max)/ 50)')) /* 
*/ ylabel(0(50) `= 50 * ceil(r(max)/ 50)' , gmax  angle(horizontal) format(%3.0f)) /* 
*/ xline(1988 1994) /*
*/ xlabel(1988 1994, axis(1)) xtitle("Year", size(small) axis(2)) xtitle("", axis(1)) plotregion(lstyle(none)) /*
*/ label(2 "Males") label(3 "Females") order(1 2)) /*
*/ legend(region(lstyle(none)) rows(1) size(small) lcolor(none)) 

Any help really 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–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index