Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: Creating long, filledin dataset from two, year variables


From   Adrian Stork <[email protected]>
To   [email protected]
Subject   Re: st: Creating long, filledin dataset from two, year variables
Date   Sun, 6 Mar 2011 17:08:08 +0100

Hi everyone,

I hope Kevin's question is answered because I'm dealing with a pretty similar
issue but with an additional trick:
There's not only one var for start-date and one var for end-date but a
large number of start and end dates
(startdate01-startdate80 & enddate01-endate80). Each start and end date indicate
the time frame in which a doctor was active in project.

So the varlist looks like:
Project*    StartDate1       Endate1    Doctor1     StartDate2
Enddate2    Doctor2   ...

*A project can be led by different doctors across time and even
simultaneously by several doctors.
 A doctor can have several projects at the same time.

For each doctor(i) I want to assign which projects he is/was working
for on a monthly basis (Long Panel)
The structure would be identical to Kevin's except for the additional projects:
Doctor    month     Project1    Project2
Smith     Jun2001    canc      vaccin
Smith     Jul2001     canc       ...
Smith     Aug2001      ...         ...
Taylor     Jan1999      ...

I tried to generate the date variable as in Kevin's case but "invalid
name" came back:

.foreach v of varlist start_date* - end_date* {
.gen new`v' = `v' - `v' if substr("`v'",-3,.) != substr("`v'",1,3)
.}

I hope someone knows how to assign the monthly date and the projects
to the doctors.
I read the FAQs regarding -reshape-,but that didn't help either. I'd
really appreciate any
comment on that and thanks, Mr.Cox,for the answer to Kevin. It gave me
a first perspective
on the issue.

Regards,
Adrian

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index