/*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 2014-2018.        */
/*                                                                     */
/***********************************************************************/

*filename pharmin '/directory/pharmacy2018.txt';                      /*reading in an un-zipped file*/
*filename pharmin pipe 'gunzip -c /directory/pharmacy2018.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=113 missover pad;
  input @001   NCPDP_ID                         $char7.
        @008   PHYSICAL_LOCATION_STATE_CODE     $char2.
        @010   PHYSICAL_LOCATION_OPEN_DATE      $char10.   /*  MMDDYY10  */
        @020   PHYSICAL_LOCATION_CLOSE_DATE     $char10.   /*  MMDDYY10  */
        @030   DISPENSER_CLASS                  $char2.
        @032   PRIMARY_DISPENSER_TYPE           $char2.
        @034   PRIMARY_TAXONOMY_CODE            $char10.
        @044   SECONDARY_DISPENSER_TYPE         $char2.
        @046   SECONDARY_TAXONOMY_CODE          $char10.
        @056   TERTIARY_DISPENSER_TYPE          $char2.
        @058   TERTIARY_TAXONOMY_CODE           $char10.
        @068   RELATIONSHIP_ID                  $char3.
        @071   RELATIONSHIP_FROM_DT             $char10.   /*  MMDDYY10  */
        @081   RELATIONSHIP_THRU_DT             $char10.   /*  MMDDYY10  */
        @091   RELATIONSHIP_TYPE                $char2.
        @093   PRNT_ORG_ID                      $char6.
        @099   EPRSCRB_SRVC_IND                 $char1.
        @100   EPRSCRB_SRVC_CD                  $char2.
        @102   DME_SRVC_IND                     $char1.
        @103   DME_SRVC_CD                      $char2.
        @105   WALKIN_CLINIC_IND                $char1.
        @106   WALKIN_CLINIC_CD                 $char2.
        @108   IMMUNIZATIONS_IND                $char1.
        @109   IMMUNIZATIONS_CD                 $char2.
        @111   STATUS_340B_IND                  $char1.
        @112   STATUS_340B_CD                   $char2.
     ;

  label  NCPDP_ID                         = "NCPDP Proprietary Pharmacy Identifier"
         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;
