CoolData blog

7 December 2009

Lazy man’s derived variables: Class decade

Filed under: Data Desk, Derived variables — Tags: , , , , — kevinmacdonell @ 10:59 am

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"
else •


Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Create a free website or blog at

%d bloggers like this: