PARTIALDEPEND Procedure

Getting Started: PARTIALDEPEND Procedure

Note: Input data must be in a table that is accessible in your session. You can refer to this table by using a two-level name. The first level is a libref, and the second level is the table name. For more information, see the section Using SAS Viya Workbench in Chapter 2, Shared Concepts.

This example illustrates some of the basic features of the PARTIALDEPEND procedure by analyzing a gradient boosting model that is trained on the cars data table.

The following DATA step creates the input data table mylib.cars:

data mylib.cars;
    set sashelp.cars;
run;

The following statements run the GRADBOOST procedure to build a gradient boosting model to predict city gas mileage for each automobile in the mylib.cars data table. The procedure also outputs an analytic store named gbStore_cars.

proc gradboost data = mylib.cars seed = 12345;
   input Cylinders Horsepower MSRP / level = interval;
   input Origin Type / level = nominal;
   target MPG_City / level = interval;
   saveState rstore = mylib.gbStore_cars;
run;

The following statements run PROC PARTIALDEPEND and produce a PD plot with ODS Graphics enabled:

ods graphics on; /* Enables ODS Graphics */
ods output PartialDependence = pd_table; /* Saves the ODS table */

proc PartialDepend data = mylib.cars seed = 12345;
   input Cylinders Horsepower MSRP / level = interval;
   input Origin Type / level = nominal;
   predictedTarget P_MPG_City;
   analysisVariable Type;
   astoreModel rstore = mylib.gbStore_cars;
run;

The DATA= option specifies the data table to use for PD analysis. The SEED= option specifies the seed to use for pseudorandom number generation. The two INPUT statements specify that the Cylinders, Horsepower, MSRP, Origin, and Type variables be used as inputs. The PREDICTEDTARGET statement specifies that the P_MPG_City variable be used as the predicted target. The ANALYSISVARIABLE statement specifies that the Type variable be used as the analysis variable. The ASTOREMODEL statement with the RSTORE= option specifies that the analytic store saved in the data table mylib.gbStore_cars be used as the model for analysis.

Figure 1 displays the average predicted city mileage by each level of the Type variable. Figure 2 displays the average predicted city mileage by Type level as a plot. It also displays the number of observations for each level of the analysis variable in the sampled data (labeled as "Count") at the bottom of the plot.

Figure 1: Partial Dependence Table

The PARTIALDEPEND Procedure

Partial Dependence
Bin (Type)TypeMean Prediction (P_MPG_City)Standard Error (P_MPG_City)Count
1Sedan20.505708290.1910949728262
2SUV17.9147487690.201425947360
3Sports21.1122825510.222794016649
4Wagon20.1430711690.222055371730
5Truck18.6510043290.248931909724
6Hybrid24.3927051390.34523867783


Figure 2: Partial Dependence Plot

 Partial Dependence Plot


Last updated: July 02, 2026