Hi there,
I have a dataset that looks like this:
I would like to create a new variable that tells me how many years between the Current Year and Birth Year values are in a list, let's say (1974, 1977, 1995, 1996, 1999, 2006). The new variable in this sample data should show the following values:
Can you please help me write a code that accomplishes this?
I have a dataset that looks like this:
| Current Year | Birth Year | Person |
| 2000 | 1980 | John |
| 2001 | 1980 | John |
| 2005 | 1963 | Emily |
| 2006 | 1963 | Emily |
| Current Year | Birth Year | Person | New Variable |
| 2000 | 1980 | John | 3 |
| 2001 | 1980 | John | 3 |
| 2005 | 1963 | Emily | 5 |
| 2006 | 1963 | Emily | 6 |

Comment