* PROGRAM NAME: OOPCV1M.SAS;
* DESCRIPTION:  MAIN MACRO THAT CALLS OTHER PROGRAMS;


%MACRO OOPCV1M(RUNYEAR=, INP=, CATEG=, PBP=, FORMULARY=);

  %IF &INPUT = INPUTPLAN %THEN %DO;
    %INCLUDE IN0(PBP_IMPORT)/SOURCE2;
    %INCLUDE IN0(PBP_IMPORT_PARTD)/SOURCE2;
  %END;

  %IF &INPUT = INPUTCMS %THEN %DO;
    %INCLUDE IN0(PBP_IMPORT_CMS)/SOURCE2;
    %INCLUDE IN0(PBP_IMPORT_PARTD_CMS)/SOURCE2;
  %END;

  %INCLUDE IN0(PBP_DRUG_VARIABLES)/SOURCE2;
  RUN;

%IF &PDP > 0 OR &MAPD > 0 %THEN %DO;

  %IF &INPUT^=INPUTCMS %THEN %DO;
    %INCLUDE IN0(BUILD_LOOKUP_SUB)/SOURCE2;
    RUN;
  %END;  
  
  %ELSE %IF &INPUT=INPUTCMS %THEN %DO;
    %INCLUDE IN0(BUILD_LOOKUP_CMS_SUB)/SOURCE2;
    RUN;
  %END;
  
  %INCLUDE IN0(BUILD_FFF_FORMAT)/SOURCE2;
  RUN;
  
  %INCLUDE IN0(BUILD_GAPDRUGS_FORMAT)/SOURCE2;
  RUN;
  
  %INCLUDE IN0(BENEFIT_OOPC_COST_CALCULATION)/SOURCE2;
  RUN;
  
%END;

%IF &PDP > 0 OR &MAPD > 0 %THEN %DO;
  %INCLUDE IN0(BASEID_DRUGS)/SOURCE2;
%END;

%MEND;
RUN;


