Tuesday, March 14, 2006
st: combining two variables into one with half-yearly date format
I have two time variables in my dataset - one for year and one for semester. Both of these variables are numeric with Year containing four-digit year values ranging from 1990 to 2005 and Semester is a 0 1 variable for fall and spring. The dataset is structured such that for each id every year has two semesters. I would like to combine the Year and Semester variables into one time variable to allow me to work with the dataset as a panel. Ultimately I hope to to tsset the dataset once I have the new variable. How do I recode (or replace) the Year and Semester variables to create one variable that is formated in the half-yearly date format? As an end result I would like to have one variable that reads 1990h1 for spring term 1990 and 1990h2 for fall term 1990, etc.
What I currently have:
ID Year Semester 1 1990 F 1 1990 S 2 1991 F 2 1991 S
What I would like to have:
ID Half-Year 1 1990h1 1 1990h2 2 1991h1 2 1991h2
Thank you in advance for your help.
-- Jennifer Delaney PhD candidate in Higher Education Stanford University firstname.lastname@example.org * * 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/
Links to this post: