To create a new variable, click + Create variable. New variables can be persisted in the output table, and also used in other parts of your transform – such as joins and filters. You can perform operations against existing variables using a wide array of methods that input different types of parameters.
For example, if we wanted to look at the ratio between total payments and billed charges for a given record, we could divide
A common method to create variables is a
Casestatement (or an 'if/else' statement), which allows you to specify one or more conditions to specify the values of the new variable.
For example, to create a boolean variable
isInArizona, we would create a comparison which finds each row where the value for
AZand sets the value of our new boolean variable to
Another common method to create variables is
Cast, which allows you to convert variables of a given type to another type. This method is useful for creating variables of uniform type to work with in other methods, coercing numeric values from string typed variables, and many other applications.
For example, we can round our float-type
average_reimbursementvariable by casting it to an integer.
If the values in the input variable(s) can't be cast to the specified type, the transform will fail, unless you specify convert to null, which will set any un-cast-able values to null.
For example, to convert dates of
mm/dd/yyformat (common in the U.S.; e.g.
03/22/89), we would specify the format string
%m/%d/%y. For a DateTime displayed as
Mon Oct 17 2016 17:32:56, we would specify
%a %b %d %Y %H:%M:%S
Below is a complete list of format elements and descriptions: