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: Impute an average in a stacked dataset


From   "Huerta, Tim" <tim.huerta@ttu.edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: Impute an average in a stacked dataset
Date   Tue, 6 Sep 2011 08:47:40 -0500

I have a stacked dataset with missing data

Yr   case     x
2004  1                   3
2005  1                  3
2006  1       4
2007  1       6
2004  2       4
2006  2       5
2007  2       7

I want to impute the value in 2005 for case 2 as the average between the value in 2004 and 2006 if and only if data exists in those years.

On another note, it would be nice to run a cross-year correlation, but I can't figure that out either. How do the values in 2004 correlate with the values in 2008?

Thanks for any help in advance!



--

Timothy R. Huerta, Ph.D.
 Director, Center for Healthcare Innovation, Education and Research
 Assistant Professor, Rawls College of Business, Texas Tech University
 Texas Tech University
 Rawls College of Business
 15th and Flint
 Lubbock, TX 79409

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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