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

This macro creates combination items and virtual claims. More...

Detailed Description

This macro creates combination items and virtual claims.

  • 1. INPUTS PHASE:
    • Set default values.
    • Convert special characters to underscores.
      • Upcase added to prevent group deduplication caused by uppercase/lowercase typos in the input file.
    • Check if the CombOrder variable has been defined.
    • CodesFile:
      • Temporality creating codetype for MS_ProcessWildcards.
    • Check if we need to keep RawStockGroup after stockpilling.
      • Process wildcards.
    • Put non diagnosis codes back in the CodesFile.
    • Sort by RawOrder to make sure the number of RawGroups to process by the Two-By-Two Method will be calculated correctly.
    • Create lookup tables for raw record extraction.
  • 2. MSCDM EXTRACTION:
    • Copy MSCDM headers/formats into an empty dataset such that there is no need for multiple "existence" management thereafter.
      • Cleaning lookup file in case the code is used both the combo and the cida settings.
      • Run envelope for diagnoses.
    • Copy MSCDM headers/formats into an empty dataset such that there is no need for multiple "existence" management thereafter.
      • Create two groups of claims (potentially non mutually exclusive):
        • Raw records for needed by the combo tool, and those needed by the MP.
    • Copy formats/lengths of the DP.
      • At least one combo with enrollment criterion.
    • Copy formats/lengths of the DP.
      • At least one combo with encounter criterion.
        • Take the smallest LOS possible across CombGroups to extract all possible eligible patients.
        • EncType and Caresetting extraction.
        • DRG Extraction.
        • Encounter observations may have missing DDates.
          • Use a max function to assign ADate to DDate when this is the case (as it is done in MPs).
    • Copy formats/lengths of the DP.
      • At least one combo with demographic criterion:
        • Sex extraction.
        • Races extraction.
        • Hispanic extraction.
  • Utility Macros for 3.1. COMBGROUP-SPECIFIC RECORDS EXTRACTION:
    • Prepare diagnosis records:
      • Restrict to diagnosis inputs.
        • Select required raw records and add combo input file information to this-combo raw records.
      • Apply caresetting criteria.
      • Apply extra criterion for PDX only in the presence of IP.
      • Create claim end date.
    • Prepare procedure records:
      • Restrict to procedure inputs.
        • Select required raw records and add combo input file information to combo raw records.
      • Apply caresetting criteria.
      • Create claim end date.
    • Prepare raw dispensing records:
      • Restrict to drug inputs.
      • Check to see if Rawcode is a length of 9 and assign to macro variable.
    • Always run this query to create empty dataset if there is no Rx9 observation:
      • Select Rx9 observations and add them to the Rx11 observations.
      • Set defaults and merge in information from original stockpiling file.
      • De-duplicate rows to correctly assign stocknumber based on group.
      • Join stocknumber back onto original dataset.
      • Store maximum number of combination of stockpiling parameters.
      • Only process dataset if there are subsetted observations.
      • Stack all datasets together.
    • Creating Edate.
      • Parameter RawDurat commented on purpose.
    • Prepare enrollment records:
      • Restrict to eligibility inputs.
        • Select required raw records and add combo input file information to combo raw records.
      • Combine the three types, duplicates records only at the RawOrder level.
    • Prepare encounter records:
      • Restrict to encounter based on EncType inputs.
        • Select required raw records and add combo input file information to combo raw records.
      • Restrict to encounter based on DRG inputs.
        • Select required raw records and add combo input file information to combo raw records.
      • Combine the two types, duplicates records only at the RawOrder level after nodupkey.
    • Prepare demographic records
      • Restrict to demogs based on sex.
        • Select required raw records and add combo input file information to combo raw records.
      • Restrict to demogs based on race.
        • Select required raw records and add combo input file information to combo raw records.
      • Restrict to demogs based on hispanic.
        • Select required raw records and add combo input file information to combo raw records.
      • Combine the two types, duplicates records only at the RawOrder level after nodupkey.
    • Prepare laboratory records:
      • Lab extraction based on lookup - LAB01.
        • Obtain the ms_test_name, ms_test_sub_category, specimen_source, ms_result_unit result_type, fast_ind and pt_loc based on RawCode.
        • Code in infolder.&LABCODESMAP. should be unique.
        • Select required raw records and add combo input file information to combo raw records.
      • Lab extraction based on LOINC - LAB02.
        • Select required raw records and add combo input file information to combo raw records.
      • Lab extraction based on PX - LABXX (XX not in (01 02)).
        • Select required raw records and add combo input file information to combo raw records.
      • Combine the three types, duplicates records only at the RawOrder level after nodupkey.
      • Removing the true duplicates as a record could have been extracted three time but using three different criteria.
    • Episode creation required (RawEpiType variable > 0).
    • Create episodes considering allowed gaps.
    • Restrict to diagnosis-like combo virtual claims:
      • Select required raw virtual records and add combo input file information to this-combo raw records.
      • Apply caresetting criteria.
      • Apply extra criterion for PDX only in the presence of IP.
      • Create claim end date.
      • Set macro variable to dynamically.
    • Restrict to procedure-like combo virtual claims:
      • Select required raw records and add combo input file information to combo raw records.
      • Apply caresetting criteria.
      • Create claim end date.
      • Set macro variable to dynamically.
    • Restrict to Drug-like combo virtual claims:
      • Select required raw records and add combo input file information to combo raw records.
      • Apply caresetting criteria.
      • Create claim end date.
      • Set macro variable to dynamically.
  • START 3. COMBGROUP LOOP:
    • Extract the number of combo groups for iteration loop.
    • Loop through ComboGroups.
      • Get current combo group.
      • Input parameters for the raw records fileres and to identify the combos.
      • Input parameters to create the virtual record.
    • 3.1. COMBGROUP-SPECIFIC RECORDS EXTRACTION:
      • Initialize two_by_two.
      • Create episode if necessary.
      • No combos to create because there is only one RawOrder value, proceed to formatting the _One dataset as if final.
        • Create Virtual claim Adate.
        • Create Virtual claim Edate.
    • 3.2. TWO-BY-TWO LOOP:
      • Loop through items to combine.
        • Check to see if this step is to apply an exclusion rule.
        • Select records to combine to _One dataset - leave the rest in _ForCombine for the next iteration of the TwoByTwo method.
        • Create Episodes (if necessary).
        • Create Overlap looking start date.
        • Create Overlap looking stop date.
        • Identify combinations.
        • In the case where exclusion=1, we will only have kept the overlaping records to exclude.
          • Remerge by NumLine and only keep those lines that are not in _TwoByTwo.
        • Apply final criteria to overlapping records.
        • Create Virtual claim ADate.
        • Create Virtual claim EDate.
        • Because of the the flexibility of RawDaysFromStartDt and RawDaysFromEndDt combined with the selection of dates for the virtual claim, check that the event did not end before starting.
  • 4. OUTPUT:
    • Get specific data partners formats and lengths.
    • Keep the virtual records in a permanent file.
Program inputs
  • indata.&DEMTABLE. (Dataset with demographic data.)
  • indata.&DIATABLE. (Dataset with diagnosis data.)
  • indata.&DISTABLE. (Dataset with dispensing data.)
  • indata.&ENCTABLE. (Dataset with encounter data.)
  • indata.&ENRTABLE. (Dataset with enrollment data.)
  • indata.&LABTABLE. (Dataset with lab result data.)
  • indata.&PROCTABLE. (Dataset with procedure data.)
  • infolder.&CODESFILE. (Dataset defining the combo codes input file.)
  • infolder.&COMBFILE. (Dataset defining the combo input file.)
  • infolder.&LABCODESMAP. (Dataset for lab result extraction.)
  • infolder.&STOCKPILINGFILE. (Dataset with valid dispensings selection used by the stockpiling algorithm to create exposure episodes.)
  • work._diag (Dataset containing diagnosis codes to extract.)
  • work._lab (Dataset containing lab result codes to extract.)
  • work._ndc (Dataset containing dispensing codes to extract.)
  • work._proc (Dataset containing procedure codes to extract.)
Program outputs
  • &DPLOCALLIB.&OUTNAME._diag (Dataset containing combination items that behave like DX.)
  • &DPLOCALLIB.&OUTNAME._drug (Dataset containing combination items that behave like RX.)
  • &DPLOCALLIB.&OUTNAME._proc (Dataset containing combination items that behave like PX.)
  • work._clab (Lookup dataset for raw labe result record extraction.)
  • work._codesfile (Dataset containing the DX combo codes.)
  • work._combfile (Dataset from the combo input file.)
  • work._combgrouplist (Dataset containing unique values of &CombOrder. CombGroup.)
  • work._combodem (Dataset containing copy of demographic variables formats/lengths.)
  • work._combodiag (Dataset containing copy of diagnosis variables formats/lengths.)
  • work._combodrug (Dataset containing copy of dispensing variables formats/lengths.)
  • work._comboenc (Dataset containing copy of encounter variables formats/lengths.)
  • work._comboenr1 (Dataset containing copy of enrollment variables formats/lengths.)
  • work._comboenr2 (Dataset containing copy of enrollment variables formats/lengths.)
  • work._comboenr3 (Dataset containing copy of enrollment variables formats/lengths.)
  • work._combolab (Dataset containing copy of lab result variables formats/lengths.)
  • work._comboproc (Dataset containing copy of procedure variables formats/lengths.)
  • work._diaformats (Dataset containing specific data partners formats and lengths for diagnosis.)
  • work._disformats (Dataset containing specific data partners formats and lengths for dispensing.)
  • work._drg (Dataset containing unique values for RawCode.)
  • work._dups (Dataset containing duplicated codes from infolder.&LABCODESMAP.)
  • work._enctype (Dataset containing unique values for RawCaresetting.)
  • work._episodes_ (Dataset containing required episodes.)
  • work._forcombine (Dataset containing raw records to combine by the TwoByTwo method.)
  • work._hispanic (Dataset for hispanic extraction.)
  • work._loopcomb (Dataset containing input parameters to create the virtual record.)
  • work._loopdem (Dataset containing demographic records.)
  • work._loopdiag (Dataset containing diagnosis records.)
  • work._loopdiagcb (Dataset containing diagnosis records and combo information.)
  • work._loopdrug (Dataset containing dispensing records.)
  • work._loopdrugcb (Dataset containing dispensing records and combo information.)
  • work._loopdrugsiter (Dataset containing RawGroup from dispensing records to stockpile.)
  • work._loopdrugsiterex (Dataset with excluded dispensing claims information.)
  • work._loopenc (Dataset containing encounter records.)
  • work._loopenr (Dataset containing enrollment records.)
  • work._looplab (Dataset containing lab records.)
  • work._loopproc (Dataset containing procedure records.)
  • work._loopproccb (Dataset containing procedure records and combo information.)
  • work._loopraw (Dataset containing raw diagnosis records.)
  • work._loopraw2 (Dataset containing raw diagnosis records.)
  • work._los (Dataset containing the smallest length of stay to extract all possible eligible patients.)
  • work._map (Dataset containing unique codes from infolder.&LABCODESMAP.)
  • work._one (Dataset containing only one RawOrder value.)
  • work._othcode (Dataset containing the combo codes other than DX.)
  • work._procformats (Dataset containing specific data partners formats and lengths for procedure.)
  • work._race (Dataset for race extraction.)
  • work._rawgrouplist (Dataset containing unique RawGroup from dispensing records.)
  • work._sex (Dataset for sex extraction.)
  • work._two (Dataset containing records to combine to _one dataset.)
  • work._twobytwo (Dataset containing combinations.)
  • work.stockpilingcombo (Dataset containing defaults information from original stockpiling file.)
  • worktemp._diagextract (Dataset containing combination items that behave like DX.)
  • worktemp._drugs (Dataset containing RX to extract.)
  • worktemp._procextract (Dataset containing combination items that behave like PX.)
  • worktemp.drugscomb (Dataset containing combination items that behave like RX.)
  • worktemp.labextract (Dataset containing labs to extract.)

Usage

%combo(COMBFILE=&COMBOFILE.,
       CODESFILE=&COMBOFILE.Codes,
       DXENVEL=&DXENVEL.,
       PXENVEL=&PXENVEL.,
       OUTNAME=&RUNID._Combo,
       STOCKPILING=1,
       STOCKPILINGFILE=&COMBOFILE.Stock,
       ENROLGAP=0,
       LABCODESMAP=&LABCODESMAP.,
       SAVETODPLOCAL=%if &QRP_DEBUG.=Y %then %do; Y %end; %else %do; N %end;,
       PTSTOEXCLUDE=&PTSTOEXCLUDE.,
       ENCIDTOEXCLUDE=&ENCIDTOEXCLUDE.);
Parameters
[in]COMBFILEName of the SAS dataset defining the Combo Input File.
[in]CODESFILEName of the SAS dataset defining the Combo Codes Input File.
[in]DXENVELIndicator to determine if the envelope should be run on diagnosis claims.
[in]PXENVELIndicator to determine if the envelope should be run on procedure claims.
[out]OUTNAMEName of the prefix that will be used to produce the output files in DPLocal if the SAVETODPLOCAL parameter is set to Y.
[in]STOCKPILINGIndicator to determine if stockpiling should be executed on outpatient pharmacy dispensings.
[in]STOCKPILINGFILEName of the SAS dataset defining the stockpiling settings for each RawGroup found in the Combo Codes Input File.
[in]ENROLGAPThe number of days that will be bridged between two consecutive enrollment periods to create a "continuously enrolled" period.
[in]LABCODESMAPName of the SAS dataset defining the Lab Code Map File.
[in]SAVETODPLOCALIndicator to determine if output files should be created in DPLocal.
[in]PTSTOEXCLUDEName of the SAS dataset defining the patients to exclude from MSDD data extraction.
[in]ENCIDTOEXCLUDEName of the SAS dataset defining the encounterids to exclude from MSDD data extraction.

SAS Macros Dependencies

Author
Sentinel Coordinating Center (info@.nosp@m.sent.nosp@m.inels.nosp@m.yste.nosp@m.m.org)