# Creating Variables: Age

Hi all! Today I’d like to a cover a pretty universally predictive variable: age. Age can be created in relation to the date of a particular event (like an application date or a mailing date), or as a reflection of age today, at this moment. Either way, age is often predictive and easy to add to your dataset by creating it in Construct from a “birth date” field.

The first step in doing so is to hook your data source to a transform node:

After opening the transform node, we’ll want to click on the function button and select the second “YearsBetween” function.

[Note: Construct is capable of outputting the number of years between two dates in two separate ways. The first function on the list calculates the number of years between two dates, regardless of the actual day and month, while the second function calculates the number of years between two dates taking day and month into account. To illustrate this point, take the dates December 1, 1960, and April 1, 1980. Using the first “YearsBetween” function, the number of years between these dates is 20. Using the second “Years Between” function, the number of years between these dates is 19. See the difference?]

Here, we have two options. We can (a) calculate age today or (b) calculate age at a specific point in time, depending on what we type in the “Enter a Formula” window.
(a) Age today:

Where ‘[A]’ corresponds to the variable in your dataset that represents birthdate, and “TODAY()” is the Today function from the drop-down menu on the right.

or
(b) Age at a specific point in time:

Where ‘[A]’ corresponds to the variable in your dataset the represents birthdate, and ‘00/00/0000’ represents the specific date on which you’d like to measure age.

Be sure to save before exiting the transform node, and there you have it, a brand-new age variable!
PS: If you guys have any specific requests for a variable to be featured in the “creating variables” series, please leave them in the comments or email me directly!
-Caitlin Garrett, Statistical Analyst at Rapid Insight