I am trying to create a variable based on employment data taken from a survey done over several years. Currently, I'm working with data that takes on a value of 0 if a person is unemployed and if they are employed, the data point represents what year of the survey the person is in and what number job they are in that year. To illustrate, if a person is in the 3rd year of the survey and is on their 2nd job that year, that would be represented as a value of 302 in the dataset. I'd like to create the variable such that it indicates what number job the person is in over the entire length of the survey. Ideally, it'd look like this:
Person employment job number
1 0 0
1 101 1
1 101 1
1 102 2
1 102 2
1 0 0
1 103 3
1 201 4
1 201 4
1 202 5
1 203 6
and so on.
I've tried using several forms of cumulative addition but can't seem to figure out how to manipulate the numbers that are bigger than 200 or get them to take on the values I want. Any advice is appreciated!
Related Posts with Cumulative sums with duplicates
Creating a panel dataset using STATAHello colleagues I am analysing the impact of COVID 19 on firms. I want to use two waves of the Wor…
Merge 7 datasetsHello. I have seven different datasets (one per year from 2007 to 2013) with all the variable being…
Adding a new empty row(year) to an existing datasetHi stata users, I have a dataset from 2008-2018, but want to add a new row 2019. I tried some codes …
Store r-class values and tabulate laterHello all, I am new to stata and my work is about medical data. My data are about diagnostic perfor…
Expand rolling sequencies of observation within ID ifHi, I am using a panel dataset with different countries (example below). For each date there are tw…
Subscribe to:
Post Comments (Atom)
0 Response to Cumulative sums with duplicates
Post a Comment