/*Published: 12/1/2020*/
/*                                                                     */
/**********************   COMMENTS   ***********************************/
/*                                                                     */
/* 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 version is for the Part D Pharmacy files for 2012-2013.        */
/*                                                                     */
/***********************************************************************/

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

options nocenter validvarname=upcase;

data pharmacy;
  infile pharmin lrecl=130 missover pad;
  input @001   CCW_PHARM_ID                     12.       /*  Encrypted  */
        @013   PREV_CCW_PHARM_ID                12.       /*  Encrypted  */
        @025   PHYSICAL_LOCATION_STATE_CODE     $char2.
        @027   PHYSICAL_LOCATION_OPEN_DATE      $char10.  /*  MMDDYY10  */
        @037   PHYSICAL_LOCATION_CLOSE_DATE     $char10.  /*  MMDDYY10  */
        @047   DISPENSER_CLASS                  $char2.
        @049   PRIMARY_DISPENSER_TYPE           $char2.
        @051   PRIMARY_TAXONOMY_CODE            $char10.
        @061   SECONDARY_DISPENSER_TYPE         $char2.
        @063   SECONDARY_TAXONOMY_CODE          $char10.
        @073   TERTIARY_DISPENSER_TYPE          $char2.
        @075   TERTIARY_TAXONOMY_CODE           $char10.
        @085   RELATIONSHIP_ID                  $char3.
        @088   RELATIONSHIP_FROM_DT             $char10.  /*  MMDDYY10  */
        @098   RELATIONSHIP_THRU_DT             $char10.  /*  MMDDYY10  */
        @108   RELATIONSHIP_TYPE                $char2.
        @110   PRNT_ORG_ID                      $char6.
        @116   EPRSCRB_SRVC_IND                 $char1.
        @117   EPRSCRB_SRVC_CD                  $char2.
        @119   DME_SRVC_IND                     $char1.
        @120   DME_SRVC_CD                      $char2.
        @122   WALKIN_CLINIC_IND                $char1.
        @123   WALKIN_CLINIC_CD                 $char2.
        @125   IMMUNIZATIONS_IND                $char1.
        @126   IMMUNIZATIONS_CD                 $char2.
        @128   STATUS_340B_IND                  $char1.
        @129   STATUS_340B_CD                   $char2.
     ;

  label  CCW_PHARM_ID                     = "CCW Pharmacy ID"
         PREV_CCW_PHARM_ID                = "Previous Owner CCW Pharmacy ID"
         PHYSICAL_LOCATION_STATE_CODE     = "Physical Location State Code"
         PHYSICAL_LOCATION_OPEN_DATE      = "Physical Location Store Open Date"
         PHYSICAL_LOCATION_CLOSE_DATE     = "Physical Location Store Closure Date"
         DISPENSER_CLASS                  = "Dispenser Class Code"
         PRIMARY_DISPENSER_TYPE           = "Primary Dispenser Type Code"
         PRIMARY_TAXONOMY_CODE            = "Taxonomy Code Mapped to Primary Dispenser Type Code"
         SECONDARY_DISPENSER_TYPE         = "Secondary Dispenser Type Code"
         SECONDARY_TAXONOMY_CODE          = "Taxonomy Code Mapped to Secondary Dispenser Type Code"
         TERTIARY_DISPENSER_TYPE          = "Tertiary Dispenser Type Code"
         TERTIARY_TAXONOMY_CODE           = "Taxonomy Code Mapped to Tertiary Dispenser Type Code"
         RELATIONSHIP_ID                  = "Encrypted Relationship ID"
         RELATIONSHIP_FROM_DT             = "Relationship From Date"
         RELATIONSHIP_THRU_DT             = "Relationship Through Date"
         RELATIONSHIP_TYPE                = "Relationship Entity Type"
         PRNT_ORG_ID                      = "Encrypted Parent Organization ID"
         EPRSCRB_SRVC_IND                 = "EPrescribing Services Indicator (Blank=No Report)"
         EPRSCRB_SRVC_CD                  = "Code Indicating the Level of EPrescribing Services Offered"
         DME_SRVC_IND                     = "DME Services Indicator (Blank=No Report)"
         DME_SRVC_CD                      = "Code Indicating the Level of DME Services Offered"
         WALKIN_CLINIC_IND                = "Walk-in Clinic Services Indicator (Blank=No Report)"
         WALKIN_CLINIC_CD                 = "Code Indicating the Level of Walk-in Clinic Services Offered"
         IMMUNIZATIONS_IND                = "Immunization Services Indicator (Blank=No Report)"
         IMMUNIZATIONS_CD                 = "Code Indicating the Level of Immunization Services Offered"
         STATUS_340B_IND                  = "340B Status Indicator (Blank=No Report)"
         STATUS_340B_CD                   = "Code Indicating the Level of 340B Services Offered"
     ;
run;

proc contents data=pharmacy position;
run;
