Driver macro to compute characteristics and produce L1 baseline table.
- Initialize variables:
- Number of unique stockgroup parameters.
- Indicator that a covariate includes an AFDD requirement.
- Used to trigger additional variable creation.
- List lab covariates with additional variables to create.
- Count number of covariates anchored to indexdt_exp.
- Assign type specific variables to keep on ADS dataset.
- Check if any covariate anchored to INDEXDT_EXP.
- Count number of groups/analysis groups to process.
- List groups to create baseline table.
- Check if stockpiling differs by group and stockgroup.
- Create dataset with combo covariate rules.
- Initialize rule and label for all covariate codes.
- Reset rules for combo covars only.
- Determine squaring conditions for sex, race, hispanic and restrict to applicable cohortgrp.
- For type 6:
- Subset group by switch evaluation step.
- If the switch is 1 or 2, subset it and reassign the index dates and agegroups.
- Create sample and list of patient.
- List of patients and sort dataset to facilitate merges.
- Compute baseline characteristics:
- Extract minimum and maximum index date values for data extraction censoring.
- Compute utilization variables.
- Extract claims for covariates and requeted risk scores.
- Risk scores computation.
- Prepare Analytic Dataset (ADS):
- Add dummy indexdt_exp variable (if necessary).
- Sort _base for subsequent merge.
- For type 5:
- Restrict to index episode.
- Evaluate covariates:
- Get list of dummy covariates (if any).
- For type 4:
- Compute additional variables to correctly assess MinExtractDt and MaxExtractDt.
- Check if covariates are anchored on EPISODEENDDT and if so take the maximum episodeenddt value.
- For MI cohorts:
- Consider the pre-pregnancy period and the maximum indexdt_exp.
- Check if covariates are anchored on INDEXDT_EXP and if so take the maximum indexdt_exp value.
- _CombineRecords stacks extracted DX/PX, dispensing, encounter and lab codes.
- Consider ExpireDt in addition to ADate to process data correctly when we have presence of dateonly='N'.
- Determine which covar# have MinRxDays > 1 and have an aFDD requirement.
- Finding claims in covariatewindow and evaluate additional covariate parameters.
- If combo covariates are defined using at least a covariate anchored on indexdt_exp, consider it as such.
- Build dynamic where clause with requested covfromanchor/covtoanchor combinations:
- covfromanchor = INDEXDT and covtoanchor = INDEXDT
- covfromanchor = INDEXDT and covtoanchor = EPISODEENDDT
- covfromanchor = EPISODEENDDT and covtoanchor = EPISODEENDDT
- covfromanchor = INDEXDT_EXP and covtoanchor = INDEXDT_EXP
- covfromanchor = INDEXDT_EXP and covtoanchor = INDEXDT
- covfromanchor = INDEXDT and covtoanchor = INDEXDT_EXP
- covfromanchor = INDEXDT_EXP and covtoanchor = EPISODEENDDT
- Process covariates where MinRxDays = 1:
- If lab covariates are requested determine anchordate to keep the one closest to covtoanchor.
- Evaluate aFDD requirement:
- Select covarnum with afdd requirement.
- Remove index dates that do not meet afdd requirement for each covar.
- Process covariates where MinRxDays > 1:
- If lab covariates are requested determine anchordate to keep the one closest to covtoanchor.
- Extract start and end date within COVFROM-COVTO window.
- Evaluate afdd requirement among covariates with a MINRXDAYS requirement.
- Select covarnum with afdd requirement.
- Remove index dates that do not meet afdd requirement for each covar.
- Determine number of stockgroups:
- If >1, then need to consolidate potential overlapping dispensings.
- If =1, then there are no overlapping dispensings after stockpiling.
- Only keep claims on _Covar1 if minrxdays satisfied (total days in window >= minrxdays).
- Process lab covariates:
- Check if additional lab variables should be created.
- For lab covariates, keep the closest to covtoanchor date.
- If there is a tie, select random.
- Compute additional lab variables.
- Count number of ADate per covariate and only keep covariate when freq >=codedays.
- Square.
- Create combo covariates.
- Surveillance mode:
- Only compute covariates for new patients.
- Add covariate booleans to _base and dplocal master file.
- Fill covars with 0s or missing if anchored on indexdt_exp and unexposed reference cohorts, pregnant cohorts, or non-pregnant cohorts.
- Create final ADS dataset:
- One dataset period PERIODID.
- Add additional variables related to lab covariates.
- For type 2:
- Adjust followuptime for episodes going beyond the PERIODID.
- Add event variable.
- For type 4:
- For type 6:
- Add switchstep variable to differentiate switches.
- Assign correct variable names for correct merging and inferential/tree analysis.
- Carry forward information from previous look in ads_mstr.
- Compute baseline table.
- If there are no patients in query, create empty baseline table.
- Create baselinetable with patient, episode and group variables.
- Rename group variable to either group/analysisgrp.
- Program inputs
- dplocal.&RUNID._&DATA. (Dataset containing one record per individual per index date for every cohort specified in the CIDA module run.)
- infolder.&COHORTFILE. (Dataset used to define enrollment and demographic requirements, type of cohort identification strategy.)
- infolder.&COVARIATECODES. (Dataset for request of covariates presence and analytic adjustment.)
- infolder.&DRUGCLASSFILE. (Dataset required for the use of drug utilization metrics.)
- infolder.&RISKSCOREFILE. (Dataset required for calculating one or more risk scores.)
- infolder.&UTILFILE. (Dataset with medical or drug utilization metrics specification.)
- Program outputs
- dplocal.&RUNID._ads_&DATA. (Dataset containing one record per GROUP, PATID, and INDEXDT.)
- msoc.&RUNID._baseline&OUTCOHORT._&I. (Dataset including metrics for cohorts of interest during baseline.)
- msoc.&RUNID._baseline_&MFU._&I. (Dataset with MFU assessment (NDCs, diagnoses, and procedures before and/or after the index date).)
- msoc.&RUNID._profile_&I. (Dataset containing patients and episodes by their unique combination of covariates observed.)
Usage
%ms_cidacov(DATA=mstr_mi,
OUTCOHORT=_mi,
GROUPVAR=group,
GROUPDEFDATA=migroupnames,
GROUPDEFVAR=cohortgrp,
COHORTGRPVAR=groupname,
SUFFIXVARNUM=,
LOOKDT=indexdt_orig);
- Parameters
-
[in] | DATA | Indicates input the patient-level dataset. |
[in] | OUTCOHORT | Indicates the suffix for output baseline table if additional cohorts are created. |
[in] | GROUPVAR | Name of variable in &data. that differentiates groups/analysis groups. |
[in] | GROUPDEFDATA | Dataset including group/analysisgrp/milgrp definitions. |
[in] | GROUPDEFVAR | Name of variable in &groupdefdata. that differentiates groups/analysis groups. |
[in] | COHORTGRPVAR | Name of cohort group variable that will be used to assess squaring conditions. |
[in] | SUFFIXVARNUM | Used in type 6 for switch step. |
[in] | LOOKDT | Date variable used for creating individual PeriodId files (indexdt/episodeenddt). |
SAS Macros Dependencies
- Author
- Sentinel Coordinating Center (info@.nosp@m.sent.nosp@m.inels.nosp@m.yste.nosp@m.m.org)