Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: RE: filling in gaps in data


From   "David Winter" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: filling in gaps in data
Date   Fri, 15 Sep 2006 07:57:48 +0100

Many thanks to Nick Cox and also Scott Merryman for their assistance
with this.

****************************************************
Mr David L. Winter, HNC
I.T. Manager
Centre for Childhood Cancer Survivor Studies
Department of Public Health & Epidemiology
University of Birmingham
Edgbaston
Birmingham
B15 2TT
UK
tel.: +44 (0)121 414 6766
fax.: +44 (0)121 414 7923
email: [email protected]
website: www.bccss.bham.ac.uk
****************************************************
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Nick Cox
Sent: 14 September 2006 18:52
To: [email protected]
Subject: st: RE: filling in gaps in data

It sounds as if "0" really means missing here. 

If so, the FAQ at http://www.stata.com/support/faqs/data/missing.html
applies with one straightforward change. 

replace CI_EV = CI_EV[_n-1] if CI_EV == 0 

Note that this would replace your first value with missing, 
and if your data are subsetted you should do this under -by:-. 

Thus I see no loops here. 

Apologies for previous null replies. 

Nick 
[email protected] 

Mr David L. Winter, HNC

I have the following data (FYI the values CI_EV and CI_RI are the
cumulative incidence value from the 'ci' option in -stcompet-)


      +--------------------------------+
      | time(hr)     CI_EV       CI_RI |
      |--------------------------------|
   1. |      1           0   .00069396 |
   2. |      2   .00069396           0 |
   3. |      3           0   .00138793 |
   4. |      4           0   .00208189 |
   5. |      5           0   .00277585 |
      |--------------------------------|
   6. |      6   .00138793           0 |
   7. |      7           0   .00346981 |
   8. |      8           0   .00416378 |
   9. |      9           0   .00485774 |
  10. |     10           0    .0055517 |
      |--------------------------------|
  11. |     11           0   .00624566 |
  12. |     12           0   .00693963 |
  13. |     13           0   .00763359 |
  14. |     14   .00208189           0 |
  15. |     15           0   .00832755 |
      |--------------------------------|
  16. |     16           0           0 |
  17. |     17           0     .009022 |
  18. |     18           0   .00971645 |
  19. |     19           0           0 |
  20. |     20           0   .01041139 |
      |--------------------------------|
  21. |     21           0   .01110633 |
  22. |     22           0   .01180126 |
  23. |     23           0    .0124962 |


As cumulative incidence is a step function I may want to identify the
value for CI_EV at, say, time =5, so I want to fill in the gaps with the
previous known value (so in the above example, the values of CI_EV for
time = 3,4 and 5 would be recoded to 0.00069396).

Some sort of loop should be in order but I am having problems with the
'grey matter'.  All assistance would be gratefully received.


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index