A person who has worked for 7 months has WorkYears = 0 and WorkMonths = 7.
A person who has worked for 20 years and 7 months has WorkYears = 20 and WorkMonths = 7.
I would like to calculate descriptive stats (mean, median, and min and max) for time worked, with meaningful values like .7 = 7 month, 20.7 = 20 yrs, 7 months, etc.
What's the best way to combine the month and year variables to arrive at total time worked?
This is what I've done:
Code: Select all
* Convert WorkYears to months. COMPUTE WorkYearsInMonths=WorkYears*12. * Calculate total time worked, in months (sum the original month variable and the new one). COMPUTE WorkMonths_Total = sum (WorkYearsInMonths, WorkMonths). * Divide by 12. COMPUTE WorkFinal=WorkMonths_Total/12. EXECUTE.
And a person who has worked 20 years and 7 months has a WorkFinal = 20.58 (i.e., 240 + 7 = 247/12).