This macro creates an age group variable consisting of custom, user-specified groupings, with allowance for any mix of time units.
More...
This macro creates an age group variable consisting of custom, user-specified groupings, with allowance for any mix of time units.
- If required, convert constant EndDate to numeric value.
- Set default values for time text string (years).
- Count time categories.
- Define each time category.
- Echo macro variable.
- Assign age categories.
- Program inputs
- &INFILE. (Dataset including start and end dates to calculate age for each observation and a text string defining the age stratifications or a dataset including a start date and a constant date parameter to calculate age for each observation and a text string defining the stratifications.)
- Program outputs
- &OUTFILE. (Dataset containing the age group for each observation.)
Usage
%ms_agestrat(INFILE=_POV1,
OUTFILE=_POV1,
STARTDT=birth_date,
ENDDT=ADate,
TIMESTRAT=&agestrat.,
DROPVARS=minagedt maxagedt);
- Parameters
-
[in] | INFILE | Input file containing start date (required). |
[out] | OUTFILE | Output file containing the age group for each observation. |
[in] | STARTDT | Start date to measure age. |
[in] | ENDDT | End date to measure age. Can be a variable or a constant date. |
[in] | TIMESTRAT | Age groups for stratification. |
[in] | DROPVARS | List of variables to drop on &OUTFILE. |
SAS Macros Dependencies
None.
- Note
- The default value for the age stratification text string is 00-01 02-04 05-09 10-14 15-18 19-21 22-44 45-64 65-74 75+
- Author
- Sentinel Coordinating Center (info@.nosp@m.sent.nosp@m.inels.nosp@m.yste.nosp@m.m.org)