Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: spellutil


From   Edwin Leuven <[email protected]>
To   [email protected]
Subject   st: spellutil
Date   Wed, 26 Mar 2003 18:09:41 +0100

Thanks to Kit Baum, three utilities for easy manipulation of timespan data 
(and the creation of a repeated cross-section) are now available through SSC:

. ssc d spellutil

I attach for those interested a small illustration below.

Hope this is useful (and not a duplication of something already in stata or 
out there)

Thanks, Ed.


. use t, clear

. cl

           id     jobid      date0      date1     hours      wage
  1.        1         1  01Jan2000  03Mar2000        30        10
  2.        1         1  04Mar2000  01Sep2000        30        10
  3.        1         2  01May2000  01Aug2000        15        12

. spellmerge, spell(date0 date1) gap(1) by(id jobid)

. cl

           id     jobid      date0      date1     hours      wage
  1.        1         1  01Jan2000  01Sep2000        30        10
  2.        1         2  01May2000  01Aug2000        15        12

. spellsplit (sum) hours (mean) wage, spell(date0 date1) by(id)

. cl

           id      date0      date1      wage     hours     _count
  1.        1  01Jan2000  01May2000        10        30          1
  2.        1  01May2000  01Aug2000        11        45          2
  3.        1  01Aug2000  01Sep2000        10        30          1

. drop _count

. spell2panel wage hours, spell(date0 date1) by(id) p(m)

. cl

           id      wage     hours        _m    _length
  1.        1        10        30    2000m1         31
  2.        1        10        30    2000m2         29
  3.        1        10        30    2000m3         31
  4.        1        10        30    2000m4         30
  5.        1        11        45    2000m5         31
  6.        1        11        45    2000m6         30
  7.        1        11        45    2000m7         31
  8.        1        10        30    2000m8         31

or more quickly, just type

. spell2panel (mean) wage (sum) hours, spell(date0 date1) by(id) p(m)

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index