While using Data Desk, I find I need to create certain derived variables expressions over and over again. Instead of composing these anew every time, I save them as text files in a place quickly accessible on my computer.
Class Year is a variable I include in nearly every set of alumni data I work with. So one of the derived variables I create most often is Class Decade.
To use, simply copy this text and paste into the expression window of a new derived variable. Replace each ‘v’ with the Class Year variable, exactly as it is named in your data set. (Best to click and drag ‘Class Year’ into the expression window, instead of typing it every time.)
if len (v) = 0 then "n/a"
else if v < 1950 then "1940s + <"
else if v < 1960 then "1950s"
else if v < 1970 then "1960s"
else if v < 1980 then "1970s"
else if v < 1990 then "1980s"
else if v < 2000 then "1990s"
else if v < 2010 then "2000s"