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]
st: Generating a row of dummies per ID based on multiple lines of panel data
From
Mark Egan <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: Generating a row of dummies per ID based on multiple lines of panel data
Date
Mon, 10 Mar 2014 08:55:00 +0000
Hello,
I simplified this problem to explain it easier: there are multiple observations of the same individual over a maximum of 35 months; from January 1990 to December 1992. Some people are present for the whole period, others drop in and out of the sample over time. Each observation per person corresponds to a different spell of employment or unemployment for that person. One spell could be a month or several years, as long as it is continuous.
I want to create a row of 35 dummies for each person, indicating whether they were employed (using a value of 0), unemployed (using a value of 1) or missing data (using a value of .) for that month. The idea is I would then reshape the data so that it was in a long format with (up to) 35 observations per person, rather than the grouping system used now.
Problem - The data now look like this:
https://www.dropbox.com/s/7o2ita0vxoxwur2/problem.png
End goal - I want them to look like this:
https://www.dropbox.com/s/on2z48qdrcrrrto/end%20goal.png
For the monthly dummies (m1, m2 ...), the desired coding is 0= employed, 1= unemployed, . = missing data for that month. The ultimate end goal I think I can reshape myself, but I don't know how to get to the state with monthly dummies.
Hope I've explained that well enough and thanks a lot for reading.
Regards,
Mark
--
The University of Stirling has been ranked in the top 12 of UK universities for graduate employment*.
94% of our 2012 graduates were in work and/or further study within six months of graduation.
*The Telegraph
The University of Stirling is a charity registered in Scotland, number SC 011159.
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/