Code:
input byte(Country Country_OLD) int year byte COW_Code_A int COW_Code_N byte WordBank_Code_A int UN_Code_N byte(Region PTS_A PTS_H PTS_S NA_Status_A NA_Status_H NA_Status_S) float(COWCODEN ccode2) long(PTSA PTSS) float pts_average . . 2000 . 2 . 840 . 1 . . 0 99 88 13 2 1 6 . . . 2001 . 2 . 840 . 2 . . 0 99 88 13 2 2 6 . . . 2002 . 2 . 840 . 2 . . 0 99 88 13 2 2 6 . . . 2003 . 2 . 840 . 2 . . 0 99 88 13 2 2 6 . . . 2004 . 2 . 840 . 3 . . 0 88 88 13 2 3 6 . . . 2005 . 2 . 840 . 3 . . 0 88 88 13 2 3 6 . . . 2006 . 2 . 840 . 3 . . 0 88 88 13 2 3 6 . . . 2007 . 2 . 840 . 3 . . 0 88 88 13 2 3 6 . . . 2008 . 2 . 840 . 3 . . 0 88 88 13 2 3 6 . . . 2009 . 2 . 840 . 3 . . 0 88 88 13 2 3 6 . . . 2010 . 2 . 840 . 3 . . 0 88 88 13 2 3 6 . . . 2011 . 2 . 840 . 3 . . 0 88 88 13 2 3 6 . . . 2012 . 2 . 840 . 3 . . 0 88 88 13 2 3 6 . . . 2013 . 2 . 840 . . 2 . 88 0 88 13 2 6 6 . . . 2014 . 2 . 840 . 2 2 . 0 0 88 13 2 2 6 . . . 2015 . 2 . 840 . 2 3 . 0 0 88 13 2 2 6 . . . 2016 . 2 . 840 . 2 3 . 0 0 88 13 2 2 6 . . . 2000 . 20 . 124 . 1 . 1 0 88 0 14 20 1 1 . . . 2001 . 20 . 124 . 1 . 1 0 88 0 14 20 1 1 . . . 2002 . 20 . 124 . 1 . 2 0 88 0 14 20 1 2 . . . 2003 . 20 . 124 . 1 . 1 0 88 0 14 20 1 1 . . . 2004 . 20 . 124 . 1 . 1 0 88 0 14 20 1 1 . . . 2005 . 20 . 124 . 1 . 1 0 88 0 14 20 1 1 .
Code:
gen pts_average=(PTS_A+PTS_S+PTS_H)/3
I found some posts about replacing missing values with values from another cell, but I don't believe it will work given that the new variable is an average, but can be replaced with the value of another cell(s) if the average is missing.
Many thanks in advance.
0 Response to Replace Missing Averages with Values from Another Cell
Post a Comment