I
I. Miller
I have a 20,000+ row table with twelve columns of monthly precipitation data.
Each column is a month of the year and each row is a yearly record. Missing
data is denoted by -9999. As you can see from a sample of the data below,
yearly records (rows) vary from being complete to having differing amounts of
missing data. It's easy enough to sort out those rows with complete data but
I would also like to sort out those rows with one, two, or three missing data
points (i.e. rows with one, two or three -9999 values). I'm after the sum of
each row (total rain per year) so I would then like to take the rows with
missing data do two things: first, average the other data fields in that row
and use that average value in place of the missing field and then sum the
row, and second, use the average of the adjacent data fields (months) to file
in the missing field (month) and then sum the row.
203 202 -9999 231 96 186 152 646 139 430 169 209
150 148 26 81 448 262 328 568 -9999 -9999 66 301
0 41 121 46 779 198 701 511 107 192 418 249
150 120 310 185 279 672 -9999 -9999 -9999 -9999 -9999 -9999
-9999 108 0 139 448 470 753 82 355 -9999 157 66
Thank you!
Ian
Each column is a month of the year and each row is a yearly record. Missing
data is denoted by -9999. As you can see from a sample of the data below,
yearly records (rows) vary from being complete to having differing amounts of
missing data. It's easy enough to sort out those rows with complete data but
I would also like to sort out those rows with one, two, or three missing data
points (i.e. rows with one, two or three -9999 values). I'm after the sum of
each row (total rain per year) so I would then like to take the rows with
missing data do two things: first, average the other data fields in that row
and use that average value in place of the missing field and then sum the
row, and second, use the average of the adjacent data fields (months) to file
in the missing field (month) and then sum the row.
203 202 -9999 231 96 186 152 646 139 430 169 209
150 148 26 81 448 262 328 568 -9999 -9999 66 301
0 41 121 46 779 198 701 511 107 192 418 249
150 120 310 185 279 672 -9999 -9999 -9999 -9999 -9999 -9999
-9999 108 0 139 448 470 753 82 355 -9999 157 66
Thank you!
Ian