Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: count non-missing elements in a series

From   "Oleksandr Shepotylo" <>
To   <>
Subject   st: count non-missing elements in a series
Date   Wed, 24 Mar 2004 18:22:49 -0500

Dear statalist,

    I am using perpetual inventory method to calculate capital stock but my
dataset has a lot of missing data on investment. I have two questions:

    1. For any given country and industry, I want to create an index that
will tell me how many
non-missing numbers in a row I have prior to any year t.
 For example,  I have investment data for country i and industry j starting
from 1965 to 1975 then missing in 1976-1977 and continuing in 1978-2001. The
index should start from 1 in 1965 till 11 in 1975. then it equals 0 in
1976-1977 and starts from 1 again in 1978.

    2. Less important, but still interesting. How to  impute missing data if
the gap- like in previous example- is less or equal to 2? Imputation can be
based on average growth in capital stock for last 3 years.

Thank you,

Oleksandr Shepotylo.

*   For searches and help try:

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