Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 73330

tsfill with panel gaps

$
0
0
I have the following panel dataset, and the year variable indicates the start and end year.
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input int(ccode year)
  2 1898
  2 2011
200 1816
200 2011
220 1816
220 1940
220 1945
220 2011
255 1816
255 1918
255 1925
255 1945
255 1991
255 2011
300 1816
300 1918
325 1860
325 1943
365 1816
365 1917
365 1922
365 2011
710 1950
710 2011
740 1895
740 1945
740 1991
740 2011
end
I want to use tsfill to fill in the gaps, but notice that some panels have multiple start/end ranges; for example, 255 begins in 1816, ends in 1918, begins again in 1925, then ends again 1945, and begins yet again in 1991, ending when the data for all panels end in 2011. I want tsfill to omit, for this example, 1919 through 1923 inclusively, and do the same for all the panels.

Viewing all articles
Browse latest Browse all 73330

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>