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: Carrying forward last value conditioned on time since last non-missing value- panel data


From   Amit Achhra <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: Carrying forward last value conditioned on time since last non-missing value- panel data
Date   Wed, 28 Aug 2013 06:03:13 +0000

Dear StataList

I was wondering if anyone could help me in this. I have panel data of the form:

id 		testdate 	glucose 	Desired output for glucose
1		23-Apr-09	5.9		5.9
1		24-Jun-09	.		5.9
1		23-Jul-09	6.7		6.7
1		24-Aug-09	.		6.7
1		6-Nov-09	.		6.7
1		22-Jan-10	.		6.7
1		22-Apr-10	5.8		5.8.
1		24-May-11	.		.
1		3-Aug-11	6.4		6.4
1		28-Dec-11	.		6.4
1		12-Sep-12	.		.	


To fill in missing values of the variable glucose, I would like to carry last non-missing value forward but only for one year ahead (i.e. only for 1 year from the last non-missing value) (see 'desired output').
This is because I'm assuming that glucose will not have an impact on my outcome if it was measured more than a year ago.

Please advice if there is a easy way to do this.

Thank you very much in advance

Amit


Amit 
Faculty of Medicine | University of New South Wales|Australia
[email protected] | www.kirby.unsw.edu.au 



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