Derives analysis age (AAGE
) and analysis age unit (AAGEU
)
Arguments
- dataset
Input dataset
The columns specified by the
start_date
and theend_date
parameter are expected.- start_date
The start date
A date or date-time object is expected.
Refer to
derive_vars_dt()
to impute and derive a date from a date character vector to a date object.Default:
BRTHDT
- end_date
The end date
A date or date-time object is expected.
Refer to
derive_vars_dt()
to impute and derive a date from a date character vector to a date object.Default:
RANDDT
- unit
Unit
The age is derived in the specified unit
Default: 'years'
Permitted Values: 'years', 'months', 'weeks', 'days', 'hours', 'minutes', 'seconds'
Details
The age is derived as the integer part of the duration from start to
end date in the specified unit. When 'years' or 'months' are specified in the out_unit
parameter, because of the underlying lubridate::time_length()
function that is used
here, results are calculated based on the actual calendar length of months or years
rather than assuming equal days every month (30.4375 days) or every year (365.25 days).
See also
ADSL Functions that returns variable appended to dataset:
derive_var_age_years()
,
derive_var_dthcaus()
,
derive_var_extreme_dtm()
,
derive_var_extreme_dt()
,
derive_vars_period()