Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: expanding dataset by n observations where n varies


From   Hind Sbihi <sbihi@interchange.ubc.ca>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: expanding dataset by n observations where n varies
Date   Fri, 14 Sep 2007 21:57:27 -0700 (PDT)

Hello Maarten

I did take a look at this command before sending my request.  However, it requires that the data is a survival time data, which is unfortunately not my case.
My data is panel data where each subject is followed over time and his/her hearing test is recorded at different point in times throughout his/her employment.
Any suggestions other than -stsplit-

Again thank you for your time 

Hind Sbihi 

School of Occupational and Environmental Health 
University of British Columbia



-----Original Message-----

> Date: Fri Sep 14 02:24:51 PDT 2007
> From: "Maarten buis" <maartenbuis@yahoo.co.uk>
> Subject: Re: st: expanding dataset by n observations where n varies
> To: statalist@hsphsun2.harvard.edu
>
> This seems to be a job for -stsplit-
> 
> Hope this helps,
> Maarten
> 
> --- Hind Sbihi <sbihi@interchange.ubc.ca> wrote:
> 
> > Dear all,
> > 
> > I am new to this listserve and hope someone will find this question
> > interesting.
> > 
> > The dataset I am working with comprises repeated observations for
> > several thousands subjects. Each observation consists of a
> > job/exposure level/hearing test combination. The data is long shaped.
> > I am trying to truncate these units of observation by year.
> > For example the following subject has only one job and 8 hearing
> > tests over 47 years (data on exposure not shown).
> > 
> >        +-----------------------------------------------------+
> >        | studyno1    startdat     enddate       testd       time |
> >        
> >          1100214   01 Aug 42   31 Dec 89   15 Feb 78      1 |
> >          1100214   01 Aug 42   31 Dec 89   15 Oct 79      2 |
> >          1100214   01 Aug 42   31 Dec 89   15 Oct 80      3 |
> >          1100214   01 Aug 42   31 Dec 89   15 Oct 81      4 |
> >          1100214   01 Aug 42   31 Dec 89   15 Dec 82      5 |
> >          1100214   01 Aug 42   31 Dec 89   15 Dec 83      6 |
> >          1100214   01 Aug 42   31 Dec 89   15 Mar 85      8 |
> >          1100214   01 Aug 42   31 Dec 89   15 Mar 87     10 |
> >     
> > My main objective is to expand these observations and obtain
> > something like this output
> > 
> >        studyno1    startdat     enddate       testd           time   
> >          1100214   01 Aug 42   31 Dec 43   .                  .
> >          1100214   01 Jan 43   31 Dec 44    .                  .
> >            .
> >            .
> >            .
> >          1100214   01 Jan 50   31 Dec 50   .                   .
> >          1100214   01 Jan 51   31 Dec 52   .                   .
> >          .
> >          .
> >          1100214   01 Jan 89   31 Dec 89   15 Mar 87    10
> > ****************************************************
> > 
> > I have tried expand command but it is not flexible enough since every
> > subject has a different number of observations.
> > I created a variable to count the number of observations that need to
> > be expanded (by rounding the ratio of job duration over 365.25 days),
> > however expandby gave strange results.
> > 
> > Any help would be very welcome
> > I would be grateful if you would let me know how to deal with this
> > problem.
> > 
> > Thank you
> > 
> > Kind regards
> > 
> > Hind Sbihi
> > 
> > School of Occupational and Environmental Health
> > University of British Columbia
> > 
> > *
> > *   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/
> > 
> 
> 
> -----------------------------------------
> Maarten L. Buis
> Department of Social Research Methodology
> Vrije Universiteit Amsterdam
> Boelelaan 1081
> 1081 HV Amsterdam
> The Netherlands
> 
> visiting address:
> Buitenveldertselaan 3 (Metropolitan), room Z434
> 
> +31 20 5986715
> 
> http://home.fsw.vu.nl/m.buis/
> -----------------------------------------
> 
> 
>       ___________________________________________________________ 
> Want ideas for reducing your carbon footprint? Visit Yahoo! For Good  http://uk.promotions.yahoo.com/forgood/environment.html
> *
> *   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/

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index