/*Published: 03/10/2025*/
/*                                                                     */
/**********************   COMMENTS   ***********************************/
/* THIS INPUT STATMENT IS FOR THE 2024 SEER-MEDICARE LINKAGE.          */
/*                                                                     */
/* IF YOU RECEIVED PDEMTM FILES BEFORE MARCH 2025 THEN YOU WILL        */
/* NEED A DIFFERENT INPUT STATEMENT. PLEASE CONTACT IMS VIA E-MAIL AT  */
/* SEER-MEDICARE@IMSWEB.COM AND AN INPUT STATEMENT WILL BE SENT TO YOU */
/***********************************************************************/
/*                                                                     */
/* Please Note: If you are using PC SAS to read in these files you     */
/* will have to un-zip the files first and use the un-zipped filename  */
/* statement, rather than using the zipped files and statement.        */
/*                                                                     */
/* This document is for the Part D MEDICATION THERAPY MANAGEMENT       */
/* files.                                                              */
/*                                                                     */
/***********************************************************************/

*filename pdemtmin '/directory/pdemtm2019.txt';                      /*reading in an un-zipped file*/
*filename pdemtmin pipe 'gunzip -c /directory/pdemtm2019.txt.gz';     /*reading in a zipped file*/
*filename pdemtmin pipe 'gunzip -c /directory/pdemtm*.txt.gz';     /*using wildcard to match multiple files */

options nocenter validvarname=upcase;

data pdemtm;
  infile pdemtmin lrecl=157 missover pad;
  input @00001 patient_id                       $CHAR15.  /*  Patient ID (for either Cancer or Non-Cancer Patients) */
        @00016 RFRNC_YR                         4.
        @00020 CONTRACT_ID                      $char5.
        @00025 TARG_CRITERIA_MET                $char1.
        @00026 LTC_ENROLLMENT                   $char1.
        @00027 COG_IMPAIRED                     $char1.
        @00028 ENROLLMENT_DT                    $char8.  /*  YYMMDD8  */
        @00038 TARG_CRITERIA_MET_DT             $char8.  /*  YYMMDD8  */
        @00048 OPT_OUT_DT                       $char8.  /*  YYMMDD8  */
        @00058 OPT_OUT_REASON                   $char2.
        @00060 CMR_OFFERED                      $char1.
        @00061 CMR_OFFERED_DT                   $char8.  /*  YYMMDD8  */
        @00071 CMR_RECEIVED                     $char1.
        @00072 CMR_RECEIVED_DT1                 $char8.  /*  YYMMDD8  */
        @00082 CMR_RECEIVED_DT2                 $char8.  /*  YYMMDD8  */
        @00092 CMR_RECEIVED_DT3                 $char8.  /*  YYMMDD8  */
        @00102 CMR_RECEIVED_DT4                 $char8.  /*  YYMMDD8  */
        @00112 CMR_RECEIVED_DT5                 $char8.  /*  YYMMDD8  */
        @00122 CMR_DELIVERY_METHOD              $char2.
        @00124 CMR_PROVIDER                     $char2.
        @00126 CMR_RECIPIENT                    $char2.
        @00128 CMR_RECEIVED_NUM                 3.
        @00131 TARG_MED_REV_NUM                 3.
        @00134 PRESCRIBER_INTERV_NUM            3.
        @00137 DRUG_THER_CHG_NUM                3.
        @00140 CMR_RECIPIENT_INI                $char2.
        @00142 TMR_PERF_DT                      $char8.
        @00150 WRIT_SUMM_DT                     $char8.
     ;

  label patient_id                       = "Patient ID"
        RFRNC_YR                         = "Year of Table"
        CONTRACT_ID                      = "Contract ID"
        TARG_CRITERIA_MET                = "Indicate beneficiary met specified targeting criteria per CMS - Part D reqs"
        LTC_ENROLLMENT                   = "Indicate if the beneficiary was a long-term care facility resident"
        COG_IMPAIRED                     = "Indicate if the beneficiary was identified as being cognitively impaired"
        ENROLLMENT_DT                    = "Date of MTM program enrollment"
        TARG_CRITERIA_MET_DT             = "Date met the specified targeting criteria per CMS - Part D requirements"
        OPT_OUT_DT                       = "Date MTM program opt-out, if applicable"
        OPT_OUT_REASON                   = "Reason participant opted-out of MTM program"
        CMR_OFFERED                      = "Indicate if the beneficiary was offered an annual comprehensive medication revie"
        CMR_OFFERED_DT                   = "Date of the initial CMR offer within the reporting period"
        CMR_RECEIVED                     = "Indicate if received annual CMR with written summary in CMS standardized format"
        CMR_RECEIVED_DT1                 = "Date of CMR with written summary in CMS standardized format I"
        CMR_RECEIVED_DT2                 = "Date of CMR with written summary in CMS standardized format II"
        CMR_RECEIVED_DT3                 = "Date of CMR with written summary in CMS standardized format III"
        CMR_RECEIVED_DT4                 = "Date of CMR with written summary in CMS standardized format IV"
        CMR_RECEIVED_DT5                 = "Date of CMR with written summary in CMS standardized format V"
        CMR_DELIVERY_METHOD              = "Method of delivery for the annual CMR"
        CMR_PROVIDER                     = "Qualified Provider who performed the CMR"
        CMR_RECIPIENT                    = "Recipient of the CMR interaction and not the recipient of the CMR documentation"
        CMR_RECEIVED_NUM                 = "Number of CMRs received with written summary in CMS standardized format"
        TARG_MED_REV_NUM                 = "Number of targeted medication reviews conducted"
        PRESCRIBER_INTERV_NUM            = "# of drug therapy problem recommendations made as a result of MTM services"
        DRUG_THER_CHG_NUM                = "# of drug therapy problem resolutions as a result of MTM services"
        CMR_RECIPIENT_INI                = "If offered a CMR, recipient of (initial) offer"
        TMR_PERF_DT                      = "Date the first TMR was performed"
        WRIT_SUMM_DT                     = "Date written summary in CMS standardized format was provided or snt"
     ;
run;

proc contents data=pdemtm position;
run;