Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
Richard Goldstein <richgold@ix.netcom.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: inserting new observations between two consecutive observations |

Date |
Wed, 27 Feb 2013 08:40:43 -0500 |

if you have exactly 3 observations per firm now and want to get to 5, as stated below, try this: sort firm year expand 3 if mod(_n,3)==0 sort firm year replace year=year[_n-1]+1 if firm==firm[_n-1] & year>1990 Rich On 2/27/13 8:18 AM, James Bernard wrote: > Well, the panel is to long and there are a few other variables. I > would need to type every firm name again > > On Wed, Feb 27, 2013 at 9:13 PM, Richard Goldstein > <richgold@ix.netcom.com> wrote: >> why not just add them at the end (or anywhere else) and then sort by >> Firm Year? >> >> Rich >> >> On 2/27/13 8:06 AM, James Bernard wrote: >>> Hi all, >>> >>> I was wondering if you know of any way for adding new observations >>> between two consecutive observations. >>> >>> Firm Year >>> -------- ---------- >>> A 1990 >>> A 1991 >>> A 1992 >>> B 1990 >>> B 1991 >>> B 1992 >>> C 1990 >>> C 1991 >>> C 1992 >>> >>> I want to add years 1993 and 1994 to the year, so it has to be >>> replaced between A-1992 and B-1990. >>> >>> I thought of -replace- command and using the loop (knowing that the >>> length for each panel is 3). but that would not work as it replaces >>> the observations. It does not insert. >>> >>> Any idea? >>> >>> Thanks, >>> James * * 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/

**References**:**st: inserting new observations between two consecutive observations***From:*James Bernard <jamesstatalist@gmail.com>

**Re: st: inserting new observations between two consecutive observations***From:*Richard Goldstein <richgold@ix.netcom.com>

**Re: st: inserting new observations between two consecutive observations***From:*James Bernard <jamesstatalist@gmail.com>

- Prev by Date:
**Re: st: inserting new observations between two consecutive observations** - Next by Date:
**re: st: repeated measures** - Previous by thread:
**Re: st: inserting new observations between two consecutive observations** - Next by thread:
**Re: st: inserting new observations between two consecutive observations** - Index(es):