Statalist The Stata Listserver


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

st: linear interpolation


From   Scott Cunningham <[email protected]>
To   [email protected]
Subject   st: linear interpolation
Date   Tue, 25 Jul 2006 15:31:58 -0400

Rafal,

You responded to my query about interpolation very well. Thanks again. I am having some trouble replicating your results, though, and I'm wondering if you can explain what you are doing in some parts of what you sent me. My data looks like this:

+---------------------------------------------------------------------+
| year fip age sex race ir |
|---------------------------------------------------------------------|
1980 AL 15 M B data
1990 AL 15 M B data
2000 AL 15 M B data

So there are 18 missing years that need interpolating by state, age, sex and race. In what you sent me, you wrote:

. local N = `_N' + 30

Q: I need to expand 18 years. But when I try to replicate what you did, I get the following error.

Contains data from ir.dta
obs: 5,318
vars: 6 25 Jul 2006 00:26
size: 116,996 (99.9% of memory free)
------------------------------------------------------------------------ -------
storage display value
variable name type format label variable label
------------------------------------------------------------------------ -------
year float %9.0g yearlbl Census year
fip float %57.0g statefiplbl
State (FIPS code)
age float %9.0g agelbl Age
sex byte %8.0g sexlbl Sex
race byte %32.0g raceglbl Race -- General
ir float %9.0g
------------------------------------------------------------------------ -------
Sorted by: fip sex race age year

. count if year==1980
1761

. count if year==1990
1774

. count if year==2000
1783

. count if ir==.
0

. local N = `_N' + 95724

. set obs `N'
obs was 5318, now 95724

. replace year=1975 + _n if year==.
(90406 real changes made)

. tsset fip year
repeated time values within panel
r(451);
*
* 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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index