BookmarkSubscribeRSS Feed
Calcite | Level 5


I have three waves of panel data 2008, 2012, 2016 and I would like to create a variable indicating transitions in employment. For example, if a person was employed in 2008, but unemployed in 2012, how would I code for this? Or if in 2012 a person went from employed to retired. Overall, I need to create a series of variables indicating change in employment status across these three years (e.g., employed 2008 to part-time 2012; employed 2008 unemployed 2016; etc.). I appreciate any help you all can provide.




As Kurt says, it depends on the format of your data, but in general the idea is to create a so-called "transition matrix." A transition matrix shows the former state (unemployed, employed, retired,....) versus the new state. Here is an example. For each employee, use the "Initial" variable to describe the state at the  beginning of the year. Use the "Final" variable to describe their state at the end of the year. In this company, many employees were promoted, some were not, and no one left the company or was demoted:

data Have;
length Initial Final $16;
input ID Initial $ Final $;
001 Hourly   Salaried
002 Salaried Management1
003 Management1 Management2
004 Management2 UpperManagement
005 UpperManagement VP
006 Hourly   Hourly
007 Hourly   Hourly
008 Salaried Salaried
009 Management2 Management2
010 UpperManagement VP
011 Hourly   Salaried
012 Salaried Salaried
013 Management1 Management2
014 Management2 UpperManagement
015 Salaried Management1
016 Hourly   Salaried
017 Salaried Management1
018 Hourly   Salaried
019 Hourly   Salaried
020 Management1 Management2

proc freq data=Have order=data;
tables initial*Final / nocum norow nocol nopercent;

If you want to do this for every year, add a YEAR variable to the data and include a BY YEAR statement in the procedure to repeat the analysis for every year.




Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg



Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 3 in conversation