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.
  • 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.
      • Confirm outcome anchors are set correctly.
      • Add MILGRP end date to monitoring file.
      • Recreate look dataset.
      • Output METADATA file.
    • 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.
    • Reset cumulative.
    • 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.
        • worktemp.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 new cohorts.
    • Level 1: Initial Episode Count - Pregnancy episodes meeting initial cohort eligibility requirements (lowcase(group)="&GROUPNAME").
      • Exposure cohort:
        • Exclusion - Linked infant exceeded maximum allowable days required between birth date and delivery date.
        • Only keep if infant is the desired sex.
    • Level 2: Exclusion - Pregnancy episodes must have evidence of the MOI (moiname = "&EXPMP." & exposuretri=1).
    • Level 3: Exclusion - Linked infant exceeded maximum allowable days required between birth date and delivery date.
    • Level 4: Exclusion - Linked infant must satisfy the sex requirement (csexmatch = "Y").
    • Control cohort:
      • Level 1: Initial Episode Count Pregnancy episodes meeting initial cohort eligibility requirements (lowcase(group)="&GROUPNAME.").
        • Only keep linked infant exceeded maximum allowable days required between birth date and delivery date.
        • Only keep if infant is the desired sex.
        • Because dplocal.&RUNID._concepi_mstr_preg_tri contains 1 row per MOI, roll up to 1 row per delivery to ensure delivery unexposed during exposure period.
        • Only 1 delivery per unexposed cohort.
          • Recode moiname to expMP to correctly count other period exposures.
      • Level 2: Exclusion - Pregnancy episodes must have evidence of the MOI (exposuretri = 1).
      • Level 2: Exclusion - Pregnancy episodes must have evidence of the MOI (only 1 delivery per unexposed cohort).
      • Level 3: Exclusion - Linked infant exceeded maximum allowable days required between birth date and delivery date.
      • Level 4: Exclusion - Linked infant must satisfy the sex requirement (csexmatch = "Y").
    • Determine maximum treewashper.
      • PSMATCH, PSIPTW and PSSTRATIFICATION creation of analysisgrp.
    • Merge exposure and comparator cohorts.
      • Define exosurefrom/exposureto date.
      • Reassign index date if begins prior to exposure from period.
      • Reassign exposure index date if begins prior to exposure from period. If exposure period starts after the end of the exposure episode then set to missing.
      • 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 matched 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.
      • Re-evaluate enrollment for baseline covariates using new index date.
      • Re-evaluate enrollment for baseline covariates 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.
      • Reassess zip_uncertain.
      • 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.
    • Tree extraction, delivery date must meet look periods.
    • Level 5: Exclusion - Live birth delivery must be during the look period.
    • Reassess Age Group criteria.
    • Level 6: Exclusion - Pregnancy episode index date must overlap the query period and satisfy the age range condition within the query period.
    • List mother and infant IDs.
    • If OUTCOMEPOP=MI we need to consider mother and infant bridged enrollment spans calculated above.
    • Select all enrollment spans for exposure group.
    • Select all enrollment spans for reference group.
    • Process additional codes: Inclusion/Exclusion and outcomes.
      • Evaluate separately for EXP and COMP cohorts.
        • Create &GROUPIND. subset.
        • Break out CaresettingPrincipal into Caresetting and Principal.
        • Extract milgrp-specific records.
        • Restricting to mothers and linked infants.
        • Make sure all claims overlap enrollment span and only keep eligible exposures (overlaping Enr_Start Enr_End).
        • Store maximum number of combination of stockpiling parameters.
        • Only process dataset if there are subsetted observations.
        • Stack all datasets together.
        • ExpireDt does not exist in _ITDrugsComb.
        • 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.
      • Extract cohort specific codes (mother and infant).
      • Select 1st event date in outcome window and merge with master episode list.
    • Restrict to 1st episode per group 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 - Restrict to first valid pregnancy episode.
  • If inclusion/exclusion dataset exists then add attrition_cond dataset to _attrition table.
    • 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.)
  • indata.&MILTABLE. (Dataset with mother-infant linkage data.)
  • 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.)
  • 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 combination items that behave like DX (&DPLOCALLIB.&outname._diag and worktemp._diagextract).)
  • 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.)
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.)
  • &COHORTCODES._mi (Dataset that includes the codes for mother-infant outcomes.)
  • &MONITORINGFILE.&A. (Dataset that defines the relevant query periods for execution.)
  • work._inclexcl (Dataset with a list of control patients and demo data.)
  • work._metadata (Dataset containing metadata for types 2 and 3.)
  • work._noexcl (Dataset containing unique values of pregnant start date per patient.)
  • work.looks (Dataset containing non overlapping looks dates.)

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)