Resources

Example 3 for PROC QUANTSELECT

/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: qrsex3                                              */
/*   TITLE: Example 3 for PROC QUANTSELECT                      */
/*    DESC: Pollution and Mortality                             */
/*     REF: Gunst, R. and Mason, R. (1980)                      */
/*                                                              */
/* PRODUCT: STAT                                                */
/*  SYSTEM: ALL                                                 */
/*    KEYS: Quantile Regression Model Selection                 */
/*   PROCS: QUANTSELECT                                         */
/*                                                              */
/* SUPPORT: Yonggang Yao                                        */
/****************************************************************/

data mortality;
   input index aap ajant ajult size65 nph nsch25 nfek ppsm snwp nowk nin3k
   hpi nopi sdpi datm DeathRate;
   label index="the index"
      aap="Average Annual Precipitation"
      ajant="Average January Temperature"
      ajult="Average July Temperature"
      size65="Size of Population older than 65"
      nph="Number of Members per Household"
      nsch25="Number of Years of Schooling for Persons over 25"
      nfek="Number of Households with fully Equipped Kitchens"
      ppsm="Population per Square Mile"
      snwp="Size of the Nonwhite Population"
      nowk="Number of Office Workers"
      nin3k="Number of Families with an Income less than $3000"
      hpi="Hydrocarbon Pollution Index"
      nopi="Nitric Oxide Pollution Index"
      sdpi="Sulfur Dioxide Pollution Index"
      datm="Degree of Atmospheric Moisture"
      DeathRate="Age-Adjusted Death Rate: Deaths per 100,000 Population";
   datalines;
 1  36  27  71   8.1  3.34  11.4  81.5  3243   8.8  42.6  11.7   21
    15   59  59   921.870
 2  35  23  72  11.1  3.14  11.0  78.8  4281   3.6  50.7  14.4    8
    10   39  57   997.875
 3  44  29  74  10.4  3.21   9.8  81.6  4260   0.8  39.4  12.4    6
     6   33  54   962.354
 4  47  45  79   6.5  3.41  11.1  77.5  3125  27.1  50.2  20.6   18
     8   24  56   982.291
 5  43  35  77   7.6  3.44   9.6  84.6  6441  24.4  43.7  14.3   43
    38  206  55  1071.289
 6  53  45  80   7.7  3.45  10.2  66.8  3325  38.5  43.1  25.5   30
    32   72  54  1030.380
 7  43  30  74  10.9  3.23  12.1  83.9  4679   3.5  49.2  11.3   21
    32   62  56   934.700
 8  45  30  73   9.3  3.29  10.6  86.0  2140   5.3  40.4  10.5    6
     4    4  56   899.529
 9  36  24  70   9.0  3.31  10.5  83.2  6582   8.1  42.5  12.6   18
    12   37  61  1001.902
10  36  27  72   9.5  3.36  10.7  79.3  4213   6.7  41.0  13.2   12
     7   20  59   912.347
11  52  42  79   7.7  3.39   9.6  69.2  2302  22.2  41.3  24.2   18
     8   27  56  1017.613
12  33  26  76   8.6  3.20  10.9  83.4  6122  16.3  44.9  10.7   88
    63  278  58  1024.885
13  40  34  77   9.2  3.21  10.2  77.0  4101  13.0  45.7  15.1   26
    26  146  57   970.467
14  35  28  71   8.8  3.29  11.1  86.3  3042  14.7  44.6  11.4   31
    21   64  60   985.950
15  37  31  75   8.0  3.26  11.9  78.4  4259  13.1  49.6  13.9   23
     9   15  58   958.839
16  35  46  85   7.1  3.22  11.8  79.9  1441  14.8  51.2  16.1    1
     1    1  54   860.101
17  36  30  75   7.5  3.35  11.4  81.9  4029  12.4  44.0  12.0    6
     4   16  58   936.234
18  15  30  73   8.2  3.15  12.2  84.2  4824   4.7  53.1  12.7   17
     8   28  38   871.766
19  31  27  74   7.2  3.44  10.8  87.0  4834  15.8  43.5  13.6   52
    35  124  59   959.221
20  30  24  72   6.5  3.53  10.8  79.5  3694  13.1  33.8  12.4   11
     4   11  61   941.181
21  31  45  85   7.3  3.22  11.4  80.7  1844  11.5  48.1  18.5    1
     1    1  53   891.708
22  31  24  72   9.0  3.37  10.9  82.8  3226   5.1  45.2  12.3    5
     3   10  61   871.338
23  42  40  77   6.1  3.45  10.4  71.8  2269  22.7  41.4  19.5    8
     3    5  53   971.122
24  43  27  72   9.0  3.25  11.5  87.1  2909   7.2  51.6   9.5    7
     3   10  56   887.466
25  46  55  84   5.6  3.35  11.4  79.7  2647  21.0  46.9  17.9    6
     5    1  59   952.529
26  39  29  76   8.7  3.23  11.4  78.6  4412  15.6  46.6  13.2   13
     7   33  60   968.665
27  35  31  81   9.2  3.10  12.0  78.3  3262  12.6  48.6  13.9    7
     4    4  55   919.729
28  43  32  74  10.1  3.38   9.5  79.2  3214   2.9  43.7  12.0   11
     7   32  54   844.053
29  11  53  68   9.2  2.99  12.1  90.6  4700   7.8  48.9  12.3  648
   319  130  47   861.833
30  30  35  71   8.3  3.37   9.9  77.4  4474  13.1  42.6  17.7   38
    37  193  57   989.265
31  50  42  82   7.3  3.49  10.4  72.5  3497  36.7  43.3  26.4   15
    10   34  59  1006.490
32  60  67  82  10.0  2.98  11.5  88.6  4657  13.6  47.3  22.4    3
     1    1  60   861.439
33  30  20  69   8.8  3.26  11.1  85.4  2934   5.8  44.0   9.4   33
    23  125  64   929.150
34  25  12  73   9.2  3.28  12.1  83.1  2095   2.0  51.9   9.8   20
    11   26  50   857.622
35  45  40  80   8.3  3.32  10.1  70.3  2682  21.0  46.1  24.1   17
    14   78  56   961.009
36  46  30  72  10.2  3.16  11.3  83.2  3327   8.8  45.3  12.2    4
     3    8  58   923.234
37  54  54  81   7.4  3.36   9.7  72.8  3172  31.4  45.5  24.2   20
    17    1  62  1113.156
38  42  33  77   9.7  3.03  10.7  83.5  7462  11.3  48.7  12.4   41
    26  108  58   994.648
39  42  32  76   9.1  3.32  10.5  87.5  6092  17.5  45.3  13.2   29
    32  161  54  1015.023
40  36  29  72   9.5  3.32  10.6  77.6  3437   8.1  45.5  13.8   45
    59  263  56   991.290
41  37  38  67  11.3  2.99  12.0  81.5  3387   3.6  50.3  13.5   56
    21   44  73   893.991
42  42  29  72  10.7  3.19  10.1  79.5  3508   2.2  38.3  15.7    6
     4   18  56   938.500
43  41  33  77  11.2  3.08   9.6  79.9  4843   2.7  38.6  14.1   11
    11   89  54   946.185
44  44  39  78   8.2  3.32  11.0  79.9  3768  28.6  49.5  17.5   12
     9   48  53  1025.502
45  32  25  72  10.9  3.21  11.1  82.5  4355   5.0  46.4  10.8    7
     4   18  60   874.281
46  34  32  79   9.3  3.23   9.7  76.8  5160  17.2  45.1  15.3   31
    15   68  57   953.560
47  10  55  70   7.3  3.11  12.1  88.9  3033   5.9  51.0  14.0  144
    66   20  61   839.709
48  18  48  63   9.2  2.92  12.2  87.7  4253  13.7  51.2  12.0  311
   171   86  71   911.701
49  13  49  68   7.0  3.36  12.2  90.7  2702   3.0  51.9   9.7  105
    32    3  71   790.733
50  35  40  64   9.6  3.02  12.2  82.5  3626   5.7  54.3  10.1   20
     7   20  72   899.264
51  45  28  74  10.6  3.21  11.1  82.6  1883   3.4  41.9  12.3    5
     4   20  56   904.155
52  38  24  72   9.8  3.34  11.4  78.0  4923   3.8  50.5  11.1    8
     5   25  61   950.672
53  31  26  73   9.3  3.22  10.7  81.3  3249   9.5  43.9  13.6   11
     7   25  59   972.464
54  40  23  71  11.3  3.28  10.3  73.8  1671   2.5  47.4  13.5    5
     2   11  60   912.202
55  41  37  78   6.2  3.25  12.3  89.5  5308  25.9  59.7  10.3   65
    28  102  52   967.803
56  28  32  81   7.0  3.27  12.1  81.0  3665   7.5  51.6  13.2    4
     2    1  54   823.764
57  45  33  76   7.7  3.39  11.3  82.2  3152  12.1  47.3  10.9   14
    11   42  56  1003.502
58  45  24  70  11.8  3.25  11.1  79.8  3678   1.0  44.8  14.0    7
     3    8  56   895.696
59  42  83  76   9.7  3.22   9.0  76.2  9699   4.8  42.2  14.5    8
     8   49  54   911.817
60  38  28  72   8.9  3.48  10.7  79.8  3451  11.7  37.5  13.0   14
    13   39  58   954.442
;

ods graphics on;
proc quantselect data=Mortality seed=800 plots=all;
   partition fraction(validate=0.3);
   model DeathRate = aap aap*aap ajant ajant*ajant ajult
      ajult*ajult size65 size65*size65 nph nph*nph nsch25
      nsch25*nsch25 nfek nfek*nfek  ppsm ppsm*ppsm snwp snwp*snwp
      nowk nowk*nowk nin3k nin3k*nin3k hpi hpi*hpi nopi
      nopi*nopi sdpi sdpi*sdpi datm datm*datm
      / quantile=0.5 selection=forward(choose=val sh=8) hier=single;
   output out=OutData p=Pred;
run;

proc print data=OutData(obs=10); run;