QRP
 
Loading...
Searching...
No Matches
ms_createmicohorts.sas File Reference

This macro creates exposure and control (unexposed, comparator) cohorts, process according to MICOHORTFILE including additional inclusion/exclusion criteria, and evaluate outcomes. More...

Detailed Description

This macro creates exposure and control (unexposed, comparator) cohorts, process according to MICOHORTFILE including additional inclusion/exclusion criteria, and evaluate outcomes.

  • Check if MIDAYSDIFF is specified, if so and MILTABLE exists,then merge in ADATE.
  • Assign libname for &RUNID._concepi_mstr_preg_tri dataset used.
  • Determine unique combination of GROUPNAME-OUTCOMEPOP-GRACEDAYS to determine if a consolidated enrollment span has been previously computed
  • Loop through milgrp.
    • MICOHORTFILE parameters.
      • Infant sex values applicable to demographics.
      • When linked infant parameters are missing, assign default values.
    • COHORTFILE for enrollment parameters.
      • Age stratification.
      • Enrollment gap.
      • Pre-pregnancy period.
    • Assess correct HDPS window for this specific milgrp.
    • For data-driven query period.
      • Determine query period.
      • Add MILGRP end date to monitoring file.
      • Recreate look dataset.
      • Output METADATA file.
    • Determine maximum treewashper to assess enrollment.
    • Custom warning if control cohort is unexposed and index date is INDEXDT_EXP.
    • Custom warning if control cohort is unexposed and outcome anchor is INDEXDT_EXP.
    • If OUTCOMEPOP = I or OUTCOMEPOP = MI, use gracedays to determine if infant enrollment start should be reassessed as the delivery date or remain as its original value.
    • If OUTCOMEPOP = MI, create consolidated mother-infant enrollment spans by bridging enrollment spans using the ENROLGAP parameter.
      • Find all infant enrollment dates from pregcohort (with gracedays applied) and also find those from worktemp.dem_infant_enr&ENRNUM. that are not in pregcohort.
      • Get all unique patid and linkedid so we can retrive all enrollment spans for this combination.
      • Join all enrollment from mothers and infants.
      • Consolidate mother-infant enrollment spans by bridging enrollment spans using the ENROLGAP parameter.
      • Change episode if maximum allowable gap is reached.
      • Reconciliation of eligible episodes.
        • outenr&ENRNUM. is the consolidated enrollment dataset formed by bridging the enrollment episodes of mothers and infants.
        • Add in consolidated enrollment dates (outcome_enr_start and outcome_end_end) to concepi_mstr_preg_tri dataset.
    • Create exposure (EOI) and reference (REF) cohorts. Cohorts are created by calling macro create_eoiref_cohorts for each cohort
      • For the EOI and exposed ref cohort, identify all pregnancies with the exposure during the exposure evaluation window
      • For the REF cohort, identify all pregnancies without the exposure during the exposure evaluation window. Because dplocal.&RUNID._concepi_mstr_preg_tri contains 1 row per MOI, roll up to 1 row per delivery
      • Exclude any pregnancy episodes if the linked infant exceeded maximum allowable days required between birth date and delivery date if only the MIL pregnancy outcome is requested for the cohort
      • Exclude any pregnancy episodes if the linked infant is not the desired sex if only the MIL pregnancy outcome is requested for the cohort
      • Create dataset to use for further exclusions:
        • Define all relevant dates (exposurefrom/exposureto, outcomefrom/outcometo).
        • Reassign index date if begins prior to exposure from period.
        • Assign ID to delivery in order to link Mothers-Infants during Incl/Excl processing.
        • Compute difference between date of enrollment and date of birth for linked infants.
        • Compute length of enrollment for linked infants.
        • For time to event analysis outcome assessment should only begin from the day of index exposure and later for cohorts with MOI.
          • Any outcome occurring before index exposure will be ignored.
          • For unexposed control cohort, exposure start window or start date should Not be considered.
        • Evaluate enrollment for HDPS window from indexdate and episode end date.
        • Re-evaluate enrollment for baseline covariates/HDPS anchored on index exposure for exposure cohort and exposed reference cohort.
        • Enrollment must be satisfied during the exposure and pre-pregnancy outcome assessment period.
          • When outcomepop=M, evaluate Treewash enrollment from outcome start date.
        • Compute followuptime and ttc for treescan.
        • Check if enrollment is met on the first day of the outcome window.
        • Recompute age, year, month and quarter using the indexdt defined by INDEXDATE.
        • Check if the indexdt defined by INDEXDATE is recorded in the query period.
        • Check if required post-pregnancy enrollment criterion is met.
      • Assess whether delivery date is during current look period (analysis =TREE)
      • Reassess age group based on user defined index date and exclude pregnancy episodes that no longer meet the age group criteria
      • Exclude episodes where the user defined index date does not overlap the query period
      • Select all enrollment spans for mothers and infants.
      • Process additional codes: Inclusion/Exclusion and outcomes.
        • Break out CaresettingPrincipal into Caresetting and Principal.
        • Extract milgrp-specific records.
        • Restrict to mother and infant records applicable to cohort
        • Make sure all claims overlap enrollment span and only keep eligible exposures (overlaping Enr_Start Enr_End).
        • Stockpile RX claims
        • Need to reshave because Stockpiling may have pushed claims outside enrollment period.
        • Create _InclExcl _FUPEvent, and _FUTforTrunk datasets.
        • Evaluate inclusion/exclusion criteria.
          • Rename variables related to episodes nomenclature to make them consistent with cida cohort episodes and easily usable in the ms_createpov3 macro.
          • Reassign original variable names.
          • Identify all conditions on inclusioncodes file.
          • If one exposure is not excluded then all exposures related to that pregnancy are not excluded.
      • Level 7: Exclusion - Pregnancy episodes must satisfy the pre-pregnancy enrollment requirements within the query period.
      • Level 8: Exclusion - Pregnancy episodes must satisfy the post-pregnancy enrollment requirements within the query period.
      • Level 9: Exclusion - Pregnancy episodes must satisfy the inclusion and exclusion criteria.
      • Check if FUT codes truncation needs to be applied.
      • Evaluate outcomes (HOIs).
        • Check if pregnancy outcomes should be assessed as HOIs and add them to the list of potential HOIs if this is the case
        • Extract cohort specific codes (mother and infant).
        • Assess incusions/exclusions criteria for events if necessary.
        • Select 1st event date in outcome window and merge with master episode list.
      • Apply micohortdef criterion and compute followuptime for time to event analysis.
        • Timetocensor should start from User-defined Indexdate.
      • Level 10: Exclusion - Must have at least 1 day of followup in the risk window.
        • For L2 analyses, this exclusion will be performed in ms_covariateadjustment after PS model.
      • Level 11: Exclusion - Pregnancy episodes must meet the micohortdef criterion.
      • Output attrition table to msoc folder.
    • Combine _eoi and _ref cohorts.
    • Compute MOI metrics for final cohorts for baseline/table 1.
      • Summarize.
      • Save to dplocal.

Program inputs
  • &LIB_CONCEPI_MSTR.&RUNID._concepi_mstr_preg_tri (Dataset containaing trimester statistics for each pregnancy outcome and medical product of interest.)
  • dplocal.&RUNID._concepi_mstr_preg_tri (Dataset for Type 4 analysis for the pregnant cohort containing trimester statistics for each pregnancy outcome and medical product of interest.)
  • infolder.&&PSFILE_CURRENT. (Dataset for PS matching (&PSMATCHFILE.), IPTW (&IPTWFILE.) and/or PS stratification (&STRATIFICATIONFILE.).)
  • infolder.&COHORTFILE. (Dataset used to define enrollment and demographic requirements, type of cohort identification strategy.)
  • infolder.&INCLUSIONCODES. (Dataset with codes used to define additional cohort inclusion/exclusion criteria.)
  • infolder.&IPTWFILE. (Dataset specifying the parameters for an IPTW analysis.)
  • infolder.&MICOHORTFILE. (Dataset for Type 4 analysis with pregnancy cohorts among pregnancies matched to an infant specification.)
  • infolder.&PSESTIMATIONFILE. (Dataset with the parameters for estimating a PS model and is required for PS-based analyses.)
  • infolder.&STRATIFICATIONFILE. (Dataset with parameters for a PS stratification analysis and required for PS-based analyses.)
  • infolder.&TREEFILE. (Dataset with parameters required to execute multiple SI analyses from a basic QRP execution.)
  • infolder.&TYPE4FILE. (Dataset required for a pregnancy episodes identification strategy.)
  • &COHORTCODES. (Dataset that includes the codes for outcomes.)
  • &MONITORINGFILE. (Dataset that defines the relevant query periods for execution.)
  • &INCLUSIONCODES. (Dataset that includes codes for inclusion criteria)
  • work._attrition (Temporary dataset with number of mother-infant pairs/pregnancy episodes excluded and remaining for each cohort.)
  • work._attrition_cond (Dataset containing defined group pregnancy episodes.)
  • work.cohortfile_for_enr (Dataset where same basecohort are grouped and assess order to process them correctly.)
  • work.hdps (Dataset containing evaluation window dates and anchor dates for high-dimensional propensity score estimation on selected analysisgrp.)
  • work.stockpile_noncovar (Dataset containing variables to stockpile.)
  • worktemp.dem_infant_enr_&ENRNUM. (Dataset containing infant enrollment spans.)
  • worktemp.drugs (Dataset containing RX to extract.)
  • worktemp.drugscomb (Dataset containing combination items that behave like RX.)
  • worktemp.enr_&ENRNUM. (Dataset containing enrollment spans.)
  • worktemp.labextract (Dataset containing labs to extract.)
  • worktemp.meds (Dataset containing combination of _diags and _procs.)
  • worktemp.milextract (Dataset with mother-infant linkage data.)
Program outputs
  • dplocal.&RUNID._mstr_mi (Dataset for Type 4 analyses produced for exposed and comparator/unexposed pregnant cohorts.)
  • msoc.&RUNID._metadata_for_time_period_&PERIODIDSTART. (Dataset used when doing sequential SI analysis.)
  • msoc.&RUNID._mil_attrition (Dataset containing the number of mother-infant pairs/pregnancy episodes excluded and remaining for each cohort for Type 4 analysis.)

Usage

%ms_createmicohorts();
Parameters
None.

SAS Macros Dependencies

Note
When creating the cohorts, the MICOHORTFILE.INDEXDATE parameter is used to assign one of the following date to the INDEXDT variable: PREGSTARTDT, INDEXDT_EXP, PREGENDDT. This is used for purposes of:
  • calculating maternal age
  • computing signal identification TTC
  • computing zip_uncertain
  • performing inferential/tree analyses.
Author
Sentinel Coordinating Center (info@.nosp@m.sent.nosp@m.inels.nosp@m.yste.nosp@m.m.org)