Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Filling data using Ipolate when data used are constrained


From   "Pavlos C. Symeou" <p.symeou@jbs.cam.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   st: Filling data using Ipolate when data used are constrained
Date   Mon, 31 Dec 2007 12:28:12 +0200

Dear Stata-listers,

I would greatly appreciate you help with this.

I have data for a number of countries over a series of years. I want to fill the missing values of my variables using the -ipolate- method; yet, I want the -ipolate- command to be applied separately for each country in a manner that the data involved in the estimation are bounded at the bottom by the earliest value of each variable. An illustration of my data follows.

In the example here, I would like to fill the missing values for mobile_users and internet_users. For mobile_users there are zero users until 1991 and there is only one missing value for 2004. For internet-users the earliest non-missing value is zero in 1990, then a few missing values follow until 1996 when non-missing values appear and then there is a new gap in the data for 2001 and 2002. For this variable I want: a) the variable to take zero values for earlier years than 1990 and b) for years after 1990 I want the missing values to be filled with the -ipolate- command which however uses data between 1990 and 2004 inclusive.

country year fixed_users mobile_users internet_users population2
Andorra 1980 6819.353 0 33
Andorra 1981 9243.998 0 37
Andorra 1982 10744.91 0 39
Andorra 1983 12396.58 0 41
Andorra 1984 13065.76 0 42
Andorra 1985 14000 0 44
Andorra 1986 15761.06 0 46
Andorra 1987 17229.59 0 48
Andorra 1988 18415.59 0 50
Andorra 1989 19701.27 0 51
Andorra 1990 21915.5 0 0 53
Andorra 1991 24329.42 0 57
Andorra 1992 26224.22 798.0653 60
Andorra 1993 27601.18 804.5187 63
Andorra 1994 28608.47 790.8131 65
Andorra 1995 28042.35 2658.823 64
Andorra 1996 27911.21 4946.93 901.4084 64
Andorra 1997 28472.68 7672.845 1780.656 66
Andorra 1998 28992.48 12422.96 3960 66
Andorra 1999 29529.67 18100.73 4393.38 66
Andorra 2000 28951.15 19921 5923.077 66
Andorra 2001 29164.27 24873.94 67.5
Andorra 2002 29385.59 27591.59 69
Andorra 2003 29448.4 43449.6 8413.948 70.5
Andorra 2004 37654.93 11820.89 72

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2022 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index