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: Extend observations in dataset


From   Torsten Häberle <[email protected]>
To   [email protected]
Subject   Re: st: Extend observations in dataset
Date   Tue, 28 Jan 2014 16:22:05 +0100

I forgot to mention:
11111 is the very last observation at the end of the dataset. The
extension should only be done to this very last observation.

Example:

Number       Year     Other variable of interest
77777       1975      9
22222       1972      8
11111        1999      5


Extension to:

Number     Year     Other variable of interest
77777     1975      9
22222     1972      8
11111      1999     5
11111      2000     .
11111      2001     .
11111      2002     .
11111      1998     .
11111      1997     .
11111      1996     .

All the observations before should not be extended. They stay exactly
the same. Only the very last one (11111 in our case).

2014-01-28 Peter Bilfiger <[email protected]>:
> I have the following dataset:
>
> Number       Year     Other variable of interest
> 11111        1999      5
>
>
> Now, I want to extend the observations so that it looks like this:
>
> Number     Year     Other variable of interest
> 11111      1999     5
> 11111      2000     .
> 11111      2001     .
> 11111      2002     .
> 11111      1998     .
> 11111      1997     .
> 11111      1996     .
>
>
> Basically extend the years by +3 and -3 and just copy the number so that for each year, there is the same number from the initial year. The other variables are not important. They can be missing.
>
> Can anybody help?
>
> Thank you.
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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