Groups | Search | Server Info | Login | Register
Groups > comp.soft-sys.sas > #969
| From | wyldsoul <wyldsoul@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.sas |
| Subject | Re: interpolating missing values |
| Date | 2011-06-21 07:03 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <b3be5650-b9e6-422e-bba2-7da5ce3a316d@y13g2000prb.googlegroups.com> (permalink) |
| References | <4be0f2da-c05f-40ba-95a7-cda03c9e3854@s16g2000prf.googlegroups.com> <q6GdnXgvtJeLVWLQnZ2dnUVZ5s2dnZ2d@giganews.com> |
Sorry about the multiple posts, had some trouble submitting. I know that this can be done in SAS, my question is how? The most difficult part for me is how to reference the first observations before and after a set of blank values to use in the interpolation. Bryan On Jun 20, 6:22 pm, "Kenneth M. Lin" <kenneth_m_...@sbcglobal.net> wrote: > You don't have to post the same question four times. Yes, you can indeed > batch interpolates in SAS but you will have to write your own code. For > starter, for each observation you could obtain the relevant information you > would need to perform the interpolation. And when the observation is > missing, you replace it with the calculated value. > > "wyldsoul" wrote in message > > news:4be0f2da-c05f-40ba-95a7-cda03c9e3854@s16g2000prf.googlegroups.com... > > Hi all, > I want to interpolate missing values from gage data. This is easy to > do manually in excel, however, I have over 60 years of water level > data from dozens of stage gages, and would like to find a way to batch > interpolate in SAS. In order to interpolate, for each set of missing > values I need to calculate the difference between the last > observation before the first blank value and the first observation > after the last blank value. Then divide the result of this by the > total number of missing values+1. Simply put: > (first obs± last obs)/(# missing obs+1) > or using the sample data from below: (6.05-6.01)/4=0.01 > > Then I need to populate each missing observation by cumulatively > adding or subtracting the result of the previous calculation to each > successive blank until you reach the next non-blank observation. > The sample dataset is below. Stage is the original value, int_factor > is the result of the first calculation, and interp_stage is the > interpolated stage based on cumulatively adding the int_factor to each > observation . > > Station date stage int_factor interp_stage > NP-P33 1-Jan-53 6.04 6.04 > NP-P33 2-Jan-53 6.03 6.03 > NP-P33 3-Jan-53 6.02 6.02 > NP-P33 4-Jan-53 6.01 6.01 > NP-P33 5-Jan-53 0.0100 6.02 > NP-P33 6-Jan-53 6.03 > NP-P33 7-Jan-53 6.04 > NP-P33 8-Jan-53 6.05 6.05 > NP-P33 9-Jan-53 6.15 6.15 > NP-P33 10-Jan-53 6.20 6.2 > NP-P33 11-Jan-53 6.20 6.2 > NP-P33 12-Jan-53 6.19 6.19 > NP-P33 13-Jan-53 6.18 6.18 > NP-P33 14-Jan-53 6.17 6.17 > NP-P33 15-Jan-53 6.16 6.16 > NP-P33 16-Jan-53 6.15 6.15 > NP-P33 17-Jan-53 6.14 6.14 > NP-P33 18-Jan-53 6.13 6.13 > NP-P33 19-Jan-53 6.12 6.12 > NP-P33 20-Jan-53 0.0091 6.11 > NP-P33 21-Jan-53 6.10 > NP-P33 22-Jan-53 6.09 > NP-P33 23-Jan-53 6.08 > NP-P33 24-Jan-53 6.07 > NP-P33 25-Jan-53 6.07 > NP-P33 26-Jan-53 6.06 > NP-P33 27-Jan-53 6.05 > NP-P33 28-Jan-53 6.04 > NP-P33 29-Jan-53 6.03 > NP-P33 30-Jan-53 6.02 6.02 > NP-P33 31-Jan-53 6.02 6.02
Back to comp.soft-sys.sas | Previous | Next — Previous in thread | Find similar
interpolating missing values wyldsoul <wyldsoul@gmail.com> - 2011-06-20 13:25 -0700
Re: interpolating missing values "Kenneth M. Lin" <kenneth_m_lin@sbcglobal.net> - 2011-06-20 15:22 -0700
Re: interpolating missing values wyldsoul <wyldsoul@gmail.com> - 2011-06-21 07:03 -0700
csiph-web