average_total_payments
by average_estimated_submitted_costs
:Case
methodCase
statement (or an 'if/else' statement), which allows you to specify one or more conditions to specify the values of the new variable.isInArizona
, we would create a comparison which finds each row where the value for provider_state
is AZ
and sets the value of our new boolean variable to TRUE
.Cast
methodCast
, 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.average_reimbursement
variable by casting it to an integer.parseDate
(to convert a string to a temporal variable) and formatDate
(to convert a temporal variable to a string) – you can specify how various fields are encoded within your data and create new variables with the appropriate type.mm/dd/yy
format (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