Bookmark and Share

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]

st: onespell


From   "Fabian Schönenberger" <sch.f@gmx.ch>
To   statalist@hsphsun2.harvard.edu
Subject   st: onespell
Date   Tue, 04 Sep 2012 11:48:55 +0200

Dear Statalist
I am using onespell, SSC stata modul from Christopher F. Baum, for panel data. I write: 

onespell fyear,saving(test)

Observations removed: -18332
file test.dta saved

fyear is a time variable (annual). For certain id, fyear has gaps if for instance the company stopped generating annual reports and started again after some years passed. I expected onespell to keep only the longest contiguous spells of fyear for each id, and other observations will be deleted from the file. But onespell adds new rows filling the gaps of fyear. In my case, onespell adds 18332 new observations (all observations except from fyear are missing). 

How can I keep the longest contiguous spells for fyear for each id and drop the other observations?

Many thanks in advance, FS
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index