first, install this package in stata:
ssc install csipolate
this is an example:
Setup
. webuse ipolxmpl1
List the data
. list, sep(0)
Create y1 containing a natural cubic spline interpolation of y on
x for missing values of y
. csipolate y x, gen(y1)
List the result
. list, sep(0)