Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Tracking Replacements Made to Variables


From   Christopher Lanoue <[email protected]>
To   [email protected]
Subject   Re: st: Tracking Replacements Made to Variables
Date   Tue, 1 Feb 2011 19:52:30 -0500

Thank you very much.
Yes, only filling gaps of length one is deliberate in this case. I have
further conditions for gaps of larger length, but with this help that should
not be a problem.

Chris

On Tue, Feb 1, 2011 at 4:20 PM, Christopher Lanoue <[email protected]> wrote:
>
> Thank you very much.
> Yes, only filling gaps of length one is deliberate in this case. I have further conditions for gaps of larger length, but with this help that should not be a problem.
>
> Chris
>
> On Tue, Feb 1, 2011 at 6:02 AM, Nick Cox <[email protected]> wrote:
>>
>> On a different tack: note that what you did is just linear
>> interpolation. See -help ipolate-.
>> What you did presupposes that times are regularly spaced (probably not
>> an issue in your case) and it will only work to fill in gaps of length
>> 1 (perhaps deliberately). -ipolate- will handle both issues. It still
>> leaves open the question of whether linear interpolation is the best
>> way to interpolate. Other interpolation commands include -cipolate-
>> and -csipolate- (SSC).
>>
>> Nick
>>
>> On Mon, Jan 31, 2011 at 9:13 PM, Christopher Lanoue <[email protected]> wrote:
>>
>> > My problem is that I am trying to keep track of changes that I make to
>> > my data [....] For instance if I have data such as:
>> >
>> > yr        var1
>> > 1961    15
>> > 1962     .
>> > 1963    20
>> > 1964     .
>> > 1965    30
>> >
>> > and I want to take the average of the two data points to fill in the
>> > missing values.
>> >
>> > I run replace var1 = (var1[_n-1]+var1[_n+1])/2 if var1 == . to
>> > accomplish this task
>>
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/statalist/faq
>> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index