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: reordering within or reversing values across variables.
From 
 
David Torres <[email protected]> 
To 
 
[email protected] 
Subject 
 
st: reordering within or reversing values across variables. 
Date 
 
Sat, 21 Aug 2010 12:42:05 -0400 
I am working with the NLSY97 employment/employer roster data and need  
to reorganize the data for analysis.
The data are currently set up in the following way:
In the first round, all respondents age 14 or older are asked about  
all jobs they have held since age 14.  A start date (mdy) and end date  
(mdy) of each job is acquired (if exact date not known, a portion is  
imputed) and each employer is given a unique identifier, which enables  
researchers to connect jobs across the survey years.  Multiple jobs  
can be listed, but most recent jobs (those with later end dates) are  
listed as job#1.
In subsequent rounds the same information is collected (all Rs are 14  
by round three so age requirement is dropped).  Older jobs, as long as  
they were worked since the date of the last interview (even if a  
survey round was missed) move down in importance among the multiple  
jobs that can be listed.  Importance is determined by end date.  A  
later end date denotes a more recent job, and the most recent job in  
each subsequent year is listed as job#1.
For each year, I'd like to list jobs in successive order.  earlier  
jobs should be listed as job#1, those following in job#2, job#3 and so  
on.
I've reshaped the date long using the string option.  Here's an  
example of what I have for just one respondent and 12 rounds:
pubid  interviewdate_	year_jobnum	empid_	beginjob_	endjob_
1      23jul1997	1997_
1		1997_1	9701	 02jul1997	23jul1997
1		1997_2	-4
1		1997_3	-4
1		1997_4	-4
1		1997_5	-4
1		1997_6	-4
1		1997_7	-4
1     17nov1998	1998_
1		1998_1	9701	 02jul1997	17nov1998
1		1998_2	-4
1		1998_3	-4
1		1998_4	-4
1		1998_5	-4
1		1998_6	-4
1		1998_7	-4
1		1998_8	-4
1		1998_9	-4
1    15dec1999	1999_
1		1999_1	199902	 15mar1999	15dec1999
1		1999_2	9701	 02jul1997	08mar1999
1		1999_3	-4
1		1999_4	-4
1		1999_5	-4
1		1999_6	-4
1		1999_7	-4
1		1999_8	-4
1		1999_9	-4
1    11dec2000	2000_
1		2000_1	199902	 15mar1999	11dec2000
1		2000_2	-4
1		2000_3	-4
1		2000_4	-4
1		2000_5	-4
1		2000_6	-4
1		2000_7	-4
1		2000_8	-4
1		2000_9	-4
1    30dec2001	2001_
1		2001_1	199902	 15mar1999	30dec2001
1		2001_2	200102	 08jan2001	30dec2001
1		2001_3	200103	 08jan2001	03aug2001
1		2001_4	-4
1		2001_5	-4
1		2001_6	-4
1		2001_7	-4
1		2001_8	-4
1    16jan2003	2002_
1		2002_1	199902	 15mar1999
1		2002_10	-4
1		2002_11	-4
1		2002_2	200102	 08jan2001
1		2002_3	-4
1		2002_4	-4
1		2002_5	-4
1		2002_6	-4
1		2002_7	-4
1		2002_8	-4
1		2002_9	-4
1		2003_
1		2003_1	0	 21feb2003	14nov2003
1		2003_10	-4
1		2003_2	-4
1		2003_3	-4
1		2003_4	-4
1		2003_5	-4
1		2003_6	-4
1		2003_7	-4
1		2003_8	-4
1		2003_9	-4
1    06dec2004	2004_
1		2004_1	200103	 21feb2003	06dec2004
1		2004_2	-4
1		2004_3	-4
1		2004_4	-4
1		2004_5	-4
1		2004_6	-4
1		2004_7	-4
1    28nov2005	2005_
1		2005_1	200103	 21feb2003	28nov2005
1		2005_2	-4
1		2005_3	-4
1		2005_4	-4
1		2005_5	-4
1		2005_6	-4
1		2005_7	-4
1		2005_8	-4
1		2005_9	-4
1    09nov2006	2006_
1		2006_1	200103	 21feb2003	09nov2006
1		2006_2	-4
1		2006_3	-4
1		2006_4	-4
1		2006_5	-4
1		2006_6	-4
1		2006_7	-4
1		2006_8	-4
1		2006_9	-4
1    17oct2007	2007_
1		2007_1	200702	 15nov2006	17oct2007
1		2007_2	200103	 21feb2003	01jan2007
1		2007_3	-4
1		2007_4	-4
1		2007_5	-4
1		2007_6	-4
1		2007_7	-4
1		2007_8	-4
1    13oct2008	2008_
1		2008_1	200702	 15nov2006	13oct2008
1		2008_2	-4
1		2008_3	-4
1		2008_4	-4
1		2008_5	-4
1		2008_6	-4
1		2008_7	-4
1		2008_8	-4
Is there a way to reorder values within a variable or to copy to a new  
variable while taking into account that some respondents have missing  
values for jobs 2, 3, 4, ... 11?
I'd like to order all jobs in all years on the beginjob_ variable so  
that job#1 is the first job held after age 14 as reported in 1997, the  
first job held since date of last interview in survey year 1998 even  
if this job is the same as that reported in 1997, etc., job #2 is the  
second job held and so on.  I then need to fill in missed survey years  
for respondents who report in a round successive to missed round(s) a  
job worked.
I also have the data in original wide format.
Thanks in advance for any advice or tips.
Ciao,
Diego Torres
*
*   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/