This macro creates combination items and virtual claims.
- 1. INPUTS PHASE:
- Execute combo_processinputfiles if run as stand alone
- 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 (if requested).
- 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.
- 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 (if requested).
- 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 (Lookup dataset containing diagnosis codes to extract (if running as part of QRP).
- work._lab (Lookup dataset containing raw lab result codes to extract (if running as part of QRP).
- work._ndc (Lookup dataset containing dispensing codes to extract (if running as part of QRP).
- work._proc (Lookup dataset containing procedure codes to extract (if running as part of QRP).
- work._clab (Lookup dataset containing lab result codes to extract (if running as part of QRP).
- work._cenr (Lookup dataset containing enrollment records to extract (if running as part of QRP).
- work._cenc (Lookup dataset containing encounter records to extract (if running as part of QRP).
- work._cdem (Lookup dataset containing demographic records to extract (if running as part of QRP).
- Program outputs
- &SAVEDATALIBREF.&OUTNAME._diag (Dataset containing combination items that behave like DX.)
- &SAVEDATALIBREF.&OUTNAME._drug (Dataset containing combination items that behave like RX.)
- &SAVEDATALIBREF.&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.)
- 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,
RUNSTANDALONE=N,
DXENVEL=&DXENVEL.,
PXENVEL=&PXENVEL.,
OUTNAME=&RUNID._Combo,
STOCKPILING=1,
STOCKPILINGFILE=&COMBOFILE.Stock,
ENROLGAP=0,
LABCODESMAP=&LABCODESMAP.,
SAVEDATALIBREF=%if &QRP_DEBUG.=Y %then %do; DPLOCAL %end;,
PTSTOEXCLUDE=&PTSTOEXCLUDE.,
ENCIDTOEXCLUDE=&ENCIDTOEXCLUDE.,
DXCOMBOLIST=&DXCOMBOLIST,
PXCOMBOLIST=&PXCOMBOLIST);
- Parameters
-
[in] | COMBFILE | Name of the SAS dataset defining the Combo Input File. |
[in] | CODESFILE | Name of the SAS dataset defining the Combo Codes Input File. |
[in] | RUNSTANDALONE | Y/N indicator whether Combo is executing within QRP (N) or as a standalone macro (Y) |
[in] | DXENVEL | Indicator to determine if the envelope should be run on diagnosis claims.
|
[in] | PXENVEL | Indicator to determine if the envelope should be run on procedure claims.
|
[out] | OUTNAME | Name of the prefix that will be used to produce the output files in DPLocal if the SAVETODPLOCAL parameter is set to Y.
|
[in] | STOCKPILING | Indicator to determine if stockpiling should be executed on outpatient pharmacy dispensings.
|
[in] | STOCKPILINGFILE | Name of the SAS dataset defining the stockpiling settings for each RawGroup found in the Combo Codes Input File.
|
[in] | ENROLGAP | The number of days that will be bridged between two consecutive enrollment periods to create a "continuously enrolled" period.
|
[in] | LABCODESMAP | Name of the SAS dataset defining the Lab Code Map File.
|
[in] | SAVEDATALIBREF | Libname where output files should be saved. If blank and RUNSTANDALONE = Y, the default will be work. If RUNSTANDALONE = N, the default will be to not save files.
|
[in] | PTSTOEXCLUDE | Name of the SAS dataset defining the patients to exclude from MSDD data extraction. |
[in] | ENCIDTOEXCLUDE | Name of the SAS dataset defining the encounterids to exclude from MSDD data extraction. |
[in] | LEFTCENSORDATE | Extract all claims occuring on or after this date. A lookback period will be added to this date using RawDaysFromStartDt and RawDaysFromEndDt. |
[in] | DXCOMBOLIST | List of DX combo codes that are utilized within QRP. |
[in] | PXCOMBOLIST | List of PX combo codes that are utilized within QRP. |
SAS Macros Dependencies
- Author
- Sentinel Coordinating Center (info@.nosp@m.sent.nosp@m.inels.nosp@m.yste.nosp@m.m.org)