Interpolation of first/last point in sample
Posted: Tue Apr 13, 2010 9:16 am
Hi,
I have a series x and, say, 4 sample periods. I want to create a series y that is the linear interpolation of the beginning and end-points of the samples.
The code above shows roughly the idea but I don't know 1) how to combine @recode with an "index" that goes from 1 to the total sample observations, or whether this is possible; 2) if y will contain the four "lines" (or if every time y.ipolate is used it creates a new series - and fills with NAs everything outside of the sample period).
Could you please help?
Thanks,
Javier
I have a series x and, say, 4 sample periods. I want to create a series y that is the linear interpolation of the beginning and end-points of the samples.
Code: Select all
sample s1 1980 1990
sample s2 1990 1998
sample s3 1998 2002
sample s4 2002 2009
for !ss=1 to 4
smpl s{!ss}
series temp=@recode([if index=1 or last],x,na)
y.ipolate temp
delete temp
next !ss
Could you please help?
Thanks,
Javier