SVMACHINE Procedure

Example 39.1 Home Equity Loan Case

This example shows how you can use PROC SVMACHINE to create scoring code that can be used to score future home equity loan applications. The data set Hmeq, which is in the Sampsio library that SAS provides, contains observations for 5,960 mortgage applicants. A variable named Bad indicates whether the customer has paid on the loan or has defaulted on it. Table 5 describes the variables in Hmeq.

Table 5: Variables in the Home Equity (Hmeq) Data Set

Variable Role Level Description
Bad Response Binary 1 = customer defaulted on the loan or is seriously delinquent
0 = customer is current on loan payments
CLAge Predictor Interval Age of oldest credit line in months
CLNo Predictor Interval Number of credit lines
DebtInc Predictor Interval Debt-to-income ratio
Delinq Predictor Interval Number of delinquent credit lines
Derog Predictor Interval Number of major derogatory reports
Job Predictor Nominal Occupational category
Loan Predictor Interval Requested loan amount
MortDue Predictor Interval Amount due on existing mortgage
nInq Predictor Interval Number of recent credit inquiries
Reason Predictor Binary DebtCon = debt consolidation
HomeImp = home improvement
Value Predictor Interval Value of current property
YoJ Predictor Interval Years at present job


You can load the Hmeq data set into your CAS session by specifying your CAS engine libref in the second statement in the following DATA step:

data mylib.hmeq;
   set sampsio.hmeq;
run;

The following statements execute the SVM algorithm on the mylib.hmeq data table:

filename codefile temp;
proc svmachine data=mylib.hmeq;
   input reason job derog delinq ninq / level=nominal;
   input loan mortdue value yoj clage clno debtinc / level=interval;
   target bad / desc;
   code file=codefile;
run;

The first INPUT statement defines the input variables Reason, Job, Derog, Delinq, and Ninq as categorical variables. The second INPUT statement defines the input variables Loan, MortDue, Value, YoJ, CLAge, CLNo, and DebtInc as continuous variables. The TARGET statement defines Bad (which is a binary variable) as the target variable and specifies the order of the target variable as descending. The CODE statement generates DATA step scoring code and stores it in the filename codefile. The scoring code can be used to score other home equity loan applications.

PROC SVMACHINE generates several ODS tables, some of which are shown in Output 39.1.1 through Output 39.1.5.

The "Model Information" table in Output 39.1.1 shows that the kernel function is linear, and the penalty parameter value is 1 (both of which are default values).

Output 39.1.1: Model Information

The SVMACHINE Procedure

Model Information
Task TypeC_CLAS
Optimization TechniqueInterior Point
ScaleYES
Kernel FunctionLinear
Penalty MethodC
Penalty Parameter1
Maximum Iterations25
Tolerance1e-06


The observations table in Output 39.1.2 shows that the total number of observations is 5,960 and the number of observations used in the training is 3,364.

Output 39.1.2: Number of Observations

Number of Observations Read5960
Number of Observations Used3364


The "Training Results" table in Output 39.1.3 shows the inner product of weights, bias, total slack, and so on.

Output 39.1.3: Training Results

Training Results
Inner Product of Weights19.8000318
Bias-1.5372926
Total Slack (Constraint Violations)532.92348
Norm of Longest Vector2.72195233
Number of Support Vectors3361
Number of Support Vectors on Margin267
Maximum F1.0000874
Minimum F-2.9999943
Number of Effects12
Columns in Data Matrix49


The "Misclassification Matrix" table in Output 39.1.4 displays the original observations and predicted values. Here the true positive is 43, the false negative is 257, the true negative is 3,055, and the false positive is 9.

Output 39.1.4: Misclassification Matrix

Misclassification Matrix
ObservedTraining Prediction
10Total
143257300
0930553064
Total5233123364


The "Fit Statistics" table in Output 39.1.5 shows information about the accuracy, error, sensitivity, and specificity.

Output 39.1.5: Fit Statistics

Fit Statistics
StatisticTraining
Accuracy0.9209
Error0.0791
Sensitivity0.1433
Specificity0.9971


In addition to these ODS tables, PROC SVMACHINE also generates the "Optimization Iteration History" table. The CODE statement in this example generates SAS code and stores at in the filename codefile. Advanced SAS users can use the SAS code to easily score their data.

Last updated: August 06, 2026