 * ---------------------------------------------------------------- ;
 * ---                       VERSION 2.1                        --- ;
 * ---------------------------------------------------------------- ;
 * The Prevention Quality Indicator (PQI) module of the AHRQ Quality
   Indicators software includes the following four programs, in
   addition to the programs CONTROL_PQI.SAS and PQFMTS.SAS:
        Program A1.  PQSASA1:  Assigns AHRQ Prevention Quality
                        Indicators to inpatient records.
        Program A2.  PQSASA2:  Calculates observed area rates for
                        Prevention Quality Indicators.
        Program A3.  PQSASA3:  Calculates risk-adjusted and
                        smoothed area rates and merges with
                        observed area rates.
        Program C2.  PQSASC2:  Calculates condition-specific rates for
                        selected Prevention Quality Indicators.

******************************************************************* ;
****************************PLEASE READ**************************** ;
******************************************************************* ;
 * The USER MUST modify portions of the following code in order to
   run this software.  With one exception (see NOTE immediately
   following this paragraph), the only changes necessary to run
   this software using your data are changes you make in this
   program (CONTROL_PQI.SAS).  The modifications you make include such
   items as specifying the name and location of your input data
   set, the year of population data to be used, and the name and
   location of output data sets.
 
 * NOTE:  CONTROL_PQI.SAS is written so that you have the option to 
          read in data from and write out data to different 
          locations.  For example, "LIBNAME1 IN1" points to the 
          location or pathname of your input data set for program
          PQSASA1 and "LIBNAME OUT1" points to the location of the 
          output data set created by the PQSASA1 program.  These 
          locations can be different.  This pattern of allowing 
          you to specify the location of each input and output 
          data set is true for each of the different programs 
          referenced in CONTROL_PQI.SAS.  However, if you wish to read 
          in and write out all data to the same location you can.   
          The easiest way to do this is to make a global 
          change in CONTROL_PQI.SAS, changing "C:\pathname" to the 
          location you wish to use.

 * NOTE:  In each of the four programs included with
          this package, as well as in the program which
          generates formats, there is a line of code that begins
          with "FILENAME CONTROL".  The USER MUST include after
          "FILENAME CONTROL" the location of the CONTROL_PQI.SAS file.

 * Generally speaking, a first-time user of this software would
   proceed as follows:
        1.  Modify CONTROL_PQI.SAS.  (MUST be done.)
        2.  In the program generating needed formats, i.e., in
            PQFMTS.SAS, specify location (path name) of
            CONTROL_PQI.SAS. (MUST be done.)
        3.  Run PQFMTS.SAS.  (MUST be done.)
        4.  In Program A1, i.e., in PQSASA1, specify location
            of CONTROL_PQI.SAS program.  (MUST be done.)
        5.  Run PQSASA1.  (MUST be done.)
        6.  In Program A2, i.e., in PQSASA2, specify location
            of CONTROL_PQI.SAS program.  (MUST be done if going to
            run Program A2.)
        7.  Run PQSASA2.  (MUST have already run Program A1.)
        8.  In Program A3, i.e., in PQSASA3, specify location
            of CONTROL_PQI.SAS program.  (MUST be done if going to
            run Program A3.)
        9.  Run PQSASA3.  (MUST have already run Programs A1 and A2.)
       10.  In Program C2, i.e., in PQSASC2, specify location
            of CONTROL_PQI.SAS program.  (MUST be done if going to
            run Program C2.)
       11.  Run PQSASC2.  (MUST have already run Program A1.)


 * ---------------------------------------------------------------- ;
 * ---                       All Programs                       --- ;
 * ---------------------------------------------------------------- ;
TITLE 'TITLE';                                  *<===USER may modify;
LIBNAME LIBRARY 'c:\pathname';                  *<==USER MUST modify;

 * ---------------------------------------------------------------- ;
 * --- INDICATE IF COUNTY-LEVEL AREAS SHOULD BE CONVERTED TO MSAs-- ;
 * ---------------------------------------------------------------- ;
%LET MSALEVL = 0;                               *<===USER may modify;

 * ---------------------------------------------------------------- ;
 * --- INDICATE IF RECORDS SHOULD BE PRINTED AT END OF EACH PGM --- ;
 * ---------------------------------------------------------------- ;
%LET PRINT = 0;                                 *<===USER may modify;


 * ---------------------------------------------------------------- ;
 * ---                         Program A1                       --- ;
 * ---------------------------------------------------------------- ;
LIBNAME IN1  'c:\pathname';                     *<==USER MUST modify;
LIBNAME OUT1 'c:\pathname';                     *<==USER MUST modify;

 * ---------------------------------------------------------------- ;
 * --- MODIFY INPUT AND OUTPUT FILE                             --- ;
 * ---------------------------------------------------------------- ;
 * --- PROGRAM DEFAULT ASSUMES THERE ARE                        --- ;
 * ---     30 DIAGNOSES (DX1-DX30)                              --- ;
 * ---     30 PROCEDURES (PR1-PR30)                             --- ;
 * ---------------------------------------------------------------- ;
 * --- MODIFY NUMBER OF DIAGNOSES AND PROCEDURES VARIABLES      --- ;
 * --- TO MATCH INPUT DATA                                      --- ;
 * ---------------------------------------------------------------- ;
%LET INFILE1  = SIDyy;                          *<==USER MUST modify;
%LET OUTFILE1 = PQA1;                           *<===USER may modify;
%LET NDX = 30;                                  *<===USER may modify;
%LET NPR = 30;                                  *<===USER may modify;


 * ---------------------------------------------------------------- ;
 * ---               Program A2 - Observed Rates                --- ;
 * ---------------------------------------------------------------- ;
 * ---------------------------------------------------------------- ;
 * NOTE:  In program A2 and in program A3, the user should select   ;
 *          the file with population data for the year that best    ;
 *          matches the discharge data.                             ;
 * In program A2,                                                   ;
 *       select one from:  QICTY97.TXT, QICTY98.TXT, QICTY99.TXT    ;
 *                         QICTY00.TXT, QICTY01.TXT, QICTY02.TXT    ;
 *                         QICTY03.TXT                              ;
 * In program A3,                                                   ;
 *       select one from:  QICTYA97.TXT, QICTYA98.TXT, QICTYA99.TXT ;
 *                         QICTYA00.TXT, QICTYA01.TXT, QICTYA02.TXT ;
 *                         QICTYA03.TXT                             ;
 * ---------------------------------------------------------------- ;
LIBNAME IN2 'c:\pathname';                     *<===USER MUST modify;
LIBNAME OUT2 'c:\pathname';                    *<===USER MUST modify;

 * ---------------------------------------------------------------- ;
 * --- TYPELEVL indicates the levels (or _TYPE_) of             --- ;
 * --- summarization to be kept in the output.                  --- ;
 * ---                                                          --- ;
 * ---  TYPELEVL      stratification                            --- ;
 * ---  --------  -------------------------                     --- ;
 * ---     0      OVERALL                                       --- ;
 * ---     1                           RACE                     --- ;
 * ---     2                     SEX                            --- ;
 * ---     3                     SEX * RACE                     --- ;
 * ---     4               AGE                                  --- ;
 * ---     5               AGE *       RACE                     --- ;
 * ---     6               AGE * SEX                            --- ;
 * ---     7               AGE * SEX * RACE                     --- ;
 * ---     8       AREA                                         --- ;
 * ---     9       AREA  *             RACE                     --- ;
 * ---    10       AREA  *       SEX                            --- ;
 * ---    11       AREA  *       SEX * RACE                     --- ;
 * ---    12       AREA  * AGE                                  --- ;
 * ---    13       AREA  * AGE *       RACE                     --- ;
 * ---    14       AREA  * AGE * SEX                            --- ;
 * ---    15       AREA  * AGE * SEX * RACE                     --- ;
 * ---                                                          --- ;
 * --- The default TYPELEVL (0,8) will provide an overall       --- :
 * --- total and an area-level totals.                          --- ;
 * ---                                                          --- ;
 * --- WARNING: TYPELEVL MUST INCLUDE 0 (Overall) and 8 (AREA)  --- ;
 * ---          IF YOU WISH TO SUBSEQUENTLY RUN PROGRAM A3.     --- ;
 * ---                                                          --- ;
 * ---------------------------------------------------------------- ;
%LET TYPELEVL = IN (0,8);                       *<===USER may modify;

 * ---------------------------------------------------------------- ;
 * --- SET NAME OF MICRODATA INPUT (OUTPUT FROM PROGRAM A1) AND --- ;
 * --- SUMMARY OUTPUT FILE OF OBSERVED RATES.                   --- ;
 * ---------------------------------------------------------------- ;
%LET INFILE2  = PQA1;                           *<===USER may modify;
%LET OUTFILA2 = PQA2;                           *<===USER may modify;

 * ---------------------------------------------------------------- ;
 * --- SET NAME OF POPULATION FILE -------------------------------- ;
 * ---------------------------------------------------------------- ;
FILENAME POPFILE2 'c:\pathname\QICTY03.TXT';   *<===USER must modify;

 * ---------------------------------------------------------------- ;
 * --- INDICATE IF WANT TO CREATE A COMMA-DELIMITED FILE FOR    --- ;
 * --- EXPORT INTO A SPREADSHEET.                               --- ;
 * ---------------------------------------------------------------- ;
%LET TEXTA2=0;                                  *<===USER may modify;

 * ---------------------------------------------------------------- ;
 * --- IF YOU CREATE A COMMA-DELIMITED FILE, SPECIFY THE LOCATION - ;
 * --- OF THE FILE.                                             --- ;
 * ---------------------------------------------------------------- ;
FILENAME PQTEXTA2 'c:\pathname\PQTEXTA2.TXT';   *<===USER may modify;


 * ---------------------------------------------------------------- ;
 * ---      Program A3 - Risk-Adjusted and Smoothed Rates       --- ;
 * ---------------------------------------------------------------- ;
 * ---------------------------------------------------------------- ;
 * NOTE:  In program A2 and in program A3, the user should select   ;
 *          the file with population data for the year that best    ;
 *          matches the discharge data.                             ;
 * In program A2,                                                   ;
 *       select one from:  QICTY97.TXT, QICTY98.TXT, QICTY99.TXT    ;
 *                         QICTY00.TXT, QICTY01.TXT, QICTY02.TXT    ;
 *                         QICTY03.TXT                              ;
 * In program A3,                                                   ;
 *       select one from:  QICTYA97.TXT, QICTYA98.TXT, QICTYA99.TXT ;
 *                         QICTYA00.TXT, QICTYA01.TXT, QICTYA02.TXT ;
 *                         QICTYA03.TXT                             ;
 * ---------------------------------------------------------------- ;
LIBNAME IN3  'c:\pathname';                    *<===USER MUST modify;
LIBNAME OUT3 'c:\pathname';                    *<===USER MUST modify;

 * ---------------------------------------------------------------- ;
 * --- SET NAME OF MICRODATA INPUT (OUTPUT FROM PROGRAM A1)     --- ;
 * ---------------------------------------------------------------- ;
%LET INFILEA3 = PQA1;                           *<===USER may modify;

 * ---------------------------------------------------------------- ;
 * --- SET NAME OF OVERALL MEAN FILE.                             - ;
 * --- THIS FILE CONTAINS THE POPULATION MEAN FOR EACH COVARIATE. - ;
 * --- BY SUBTRACTING THE POPULATION MEAN FROM THE INDEPENDENT    - ;
 * --- VARIABLES OF THE REGRESSION, THE AREA ESTIMATES REFLECT    - ;
 * --- THE PREVENTION QUALITY INDICATOR FOR THE "AVERAGE" PATIENT,- ;
 * --- RATHER THAN THE OMITTED CATEGORY. THERE IS ONE OBSERVATION - ;
 * --- PER PREVENTION QUALITY INDICATOR.                          - ;
 * ---------------------------------------------------------------- ;
FILENAME MEANSA 'c:\pathname\MNSPQA00.TXT';    *<===USER MUST modify;

 * ---------------------------------------------------------------- ;
 * --- SET NAME OF COVARIATE FILE.                                - ;
 * --- THIS FILE CONTAINS THE REGRESSION COEFFICIENTS FOR EACH    - ;
 * --- COVARIATE.  THERE IS ONE OBSERVATION PER PREVENTION        - ;
 * --- QUALITY INDICATOR.                                         - ;
 * ---------------------------------------------------------------- ;
FILENAME COVARA 'c:\pathname\COVPQA00.TXT';    *<===USER MUST MODIFY;

 * ---------------------------------------------------------------- ;
 * --- SET NAME OF POPULATION FILE                                - ;
 * --- THIS FILE CONTAINS THE POPULATION COUNTS FOR EACH METRO    - ;
 * --- AREA (OR NON-MSA COUNTY) BY AGE AND SEX CATEGORY.          - ;
 * ---------------------------------------------------------------- ;
FILENAME POPFILE3 'c:\pathname\QICTYA03.TXT';  *<===USER MUST modify;

 * ---------------------------------------------------------------- ;
 * --- SET NAME OF MSX STATISTICS FILE                            - ;
 * --- FILE CONTAINS A SET OF THREE ARRAYS.  THE FIRST ARRAY      - ;
 * --- CONTAINS NOISE ESTIMATES, THE SECOND SIGNAL ESTIMATES,     - ;
 * --- AND THE THIRD MEAN AREA RATES FOR EACH PREVENTION QUALITY  - ;
 * --- INDICATOR.                                                 - ;
 * ---------------------------------------------------------------- ;
FILENAME MSX 'c:\pathname\MSXPQA00.TXT';       *<===USER MUST modify;

 * ---------------------------------------------------------------- ;
 * --- SET NAME OF INPUT RATES FILE (OUTPUT FROM PROGRAM A2) and--- ;
 * --- AREA LEVEL OUTPUT FILE.                                  --- ;
 * ---------------------------------------------------------------- ;
%LET INFILEA2  = PQA2;                          *<===USER may modify;
%LET OUTFILA3  = PQA3;                          *<===USER may modify;

 * ---------------------------------------------------------------- ;
 * --- INDICATE IF WANT TO CREATE A COMMA-DELIMITED FILE FOR    --- ;
 * --- EXPORT INTO A SPREADSHEET.                               --- ;
 * ---------------------------------------------------------------- ;
%LET TEXTA3=0;                                  *<===USER may modify;

 * ---------------------------------------------------------------- ;
 * --- IF YOU CREATE A COMMA-DELIMITED FILE, SPECIFY THE LOCATION - ;
 * --- OF THE FILE.                                             --- ;
 * ---------------------------------------------------------------- ;
FILENAME PQTEXTA3 'c:\pathname\PQTEXTA3.TXT';   *<===USER may modify;


 * ---------------------------------------------------------------- ;
 * ---               Program C2 - Condition-specific Rates      --- ;
 * ---------------------------------------------------------------- ;
 * ---------------------------------------------------------------- ;
 * NOTE:  In program C2, the user should select the file with       ;
 *          population data for the year that best matches the      ;
 *          discharge data.                                         ;
 * In program C2,                                                   ;
 *       select one from:  QICTYC97.TXT, QICTYC98.TXT, QICTYC99.TXT ;
 *                         QICTYC00.TXT, QICTYC01.TXT, QICTYC02.TXT ;
 *                         QICTYC03.TXT                             ;
 * ---------------------------------------------------------------- ;
LIBNAME INC2 'c:\pathname';                    *<===USER MUST modify;
LIBNAME OUTC2 'c:\pathname';                   *<===USER MUST modify;

 * ---------------------------------------------------------------- ;
 * --- SET NAME OF MICRODATA INPUT (OUTPUT FROM PROGRAM A1) AND --- ;
 * --- SUMMARY OUTPUT FILE OF OBSERVED RATES.                   --- ;
 * ---------------------------------------------------------------- ;
%LET INFILEC2 = PQA1;                           *<===USER may modify;
%LET OUTFILC2 = PQC2;                           *<===USER may modify;

 * ---------------------------------------------------------------- ;
 * --- SET NAME OF POPULATION FILE -------------------------------- ;
 * ---------------------------------------------------------------- ;
FILENAME POPFILC2 'c:\pathname\QICTYC03.TXT';   *<===USER must modify;

 * ---------------------------------------------------------------- ;
 * --- INDICATE IF WANT TO CREATE A COMMA-DELIMITED FILE FOR    --- ;
 * --- EXPORT INTO A SPREADSHEET.                               --- ;
 * ---------------------------------------------------------------- ;
%LET TEXTC2=0;                                  *<===USER may modify;

 * ---------------------------------------------------------------- ;
 * --- IF YOU CREATE A COMMA-DELIMITED FILE, SPECIFY THE LOCATION - ;
 * --- OF THE FILE.                                             --- ;
 * ---------------------------------------------------------------- ;
FILENAME PQTEXTC2 'c:\pathname\PQTEXTC2.TXT';   *<===USER may modify;

