The OPTMODEL Procedure

ODS Table and Variable Names

PROC OPTMODEL assigns a name to each table it creates. You can use these names to reference the table when you use the Output Delivery System (ODS) to select tables and create output data sets. The names of tables common to all solvers are listed in Table 12. Some solvers can generate additional tables; see the individual solver chapters for more information. For more information about ODS, see SAS Output Delivery System: User’s Guide.

Table 12: ODS Tables Produced in PROC OPTMODEL

ODS Table Name Description Statement/Option
DerivMethods List of derivatives used by the solver, including the method of computation SOLVE
OptStatistics Solver-dependent description of the resources required for solution, including function evaluations and solver time SOLVE
PrintTable Specified parameter or variable values PRINT
ProblemSummary Description of objective, variables, and constraints SOLVE
ProfileInfo Detailed timing of statements and declarations PROFILE
SolutionSummary Overview of solution, including solver-dependent solution quality values SOLVE
SolverOptions List of solver options and their values SOLVE
Timing Detailed solution timing SOLVE


To guarantee that ODS output data sets contain information from all executed statements, use the PERSIST= option in the ODS OUTPUT statement. For details, see SAS Output Delivery System: User’s Guide. Note: The SUBMIT statement resets ODS SELECT and EXCLUDE lists.

Table 13 lists the variable names of the preceding tables used in the ODS template of the OPTMODEL procedure.

Table 13: Variable Names for the ODS Tables Produced in PROC OPTMODEL

ODS Table Name Variables
DerivMethods Label1, cValue1, and nValue1
OptStatistics Label1, cValue1, and nValue1
PrintTable (matrix form) ROW, COL1 – COLn
PrintTable (table form) COL1 – COLn, identifier-expression(_suffix)
ProblemSummary Label1, cValue1, and nValue1
ProfileInfo Item, Line, Column, Count, MemSize (optional), NetTime, WaitTime, and PctTime
SolutionSummary Label1, cValue1, and nValue1
SolverOptions Label1, cValue1, nValue1, cValue2, and nValue2
Timing Label1, cValue1, nValue1, cValue2, and nValue2


The PRINT statement produces an ODS table named PrintTable. The variable names that are used depend on the display format used. See the section Formatted Output for details about choosing the display format.

For the PRINT statement with table format, the columns that display array indices are named COL1–COLn, where n is the number of index elements. Columns that display values from identifier expressions are named using the expression’s name and suffix. The identifier name becomes the output variable name if no suffix is used. Otherwise the variable name is formed by appending an underscore (_) and the suffix to the identifier name. Columns that display the value of expressions are named COLn, where n is the column number in the table.

For the PRINT statement with matrix format, the first column has the variable name ROW. The remaining columns are named COL1–COLn, where n is the number of distinct column indices. When an ODS table displays values from identifier expressions, a label is generated based on the expression’s name and suffix, as described for column names in the case of table format.

The PRINTLEVEL= option controls the ODS tables produced by the SOLVE and COFOR statements. When PRINTLEVEL=0, the statements produce no ODS tables. When PRINTLEVEL=1, the SOLVE statement produces the ODS tables ProblemSummary and SolutionSummary. When PRINTLEVEL=2, the SOLVE statement produces the ODS tables ProblemSummary, SolverOptions, DerivMethods, SolutionSummary, OptStatistics, and Timing.

The following statements generate several ODS tables and write each table to a SAS data set:

proc optmodel printlevel=2;
   ods output PrintTable=expt ProblemSummary=exps DerivMethods=exdm
              SolverOptions=exso SolutionSummary=exss OptStatistics=exos
              Timing=exti;
   var x{1..2} >= 0;
   min z = 2*x[1] + 3 * x[2] + x[1]**2 + 10*x[2]**2
           + 2.5*x[1]*x[2] + x[1]**3;
   con c1: x[1] - x[2] <= 1;
   con c2: x[1] + 2*x[2] >= 100;
   solve;
   print x;

The data set expt contains the PrintTable table and is shown in Figure 48. The variable names are COL1 and x.

Figure 48: PrintTable ODS Table

PrintTable

ObsCOL1x
1110.448
2244.776


The data set exps contains the ProblemSummary table and is shown in Figure 49. The variable names are Label1, cValue1, and nValue1. The rows describe the instance, and the description depends on the form of the problem. In most solvers, the rows describe the objective function, variables, and constraints. In the network solver, the rows describe the number of nodes, the number of edges, the directedness of the graph, and the type of problem solved over the graph.

Figure 49: ProblemSummary ODS Table

ProblemSummary

ObsLabel1cValue1nValue1
1Objective SenseMinimization.
2Objective Functionz.
3Objective TypeNonlinear.
4  .
5Number of Variables22.000000
6Bounded Above00
7Bounded Below22.000000
8Bounded Below and Above00
9Free00
10Fixed00
11  .
12Number of Constraints22.000000
13Linear LE (<=)11.000000
14Linear EQ (=)00
15Linear GE (>=)11.000000
16Linear Range00


The data set exso contains the SolverOptions table and is shown in Figure 50. The variable names are Label1, cValue1, nValue1, cValue2, and nValue2. The rows, which depend on the solver called by PROC OPTMODEL, list the values taken by each of the solver options. The presence of an asterisk (*) next to an option indicates that a value has been specified for that option.

Figure 50: SolverOptions ODS Table

SolverOptions

ObsLabel1cValue1nValue1cValue2nValue2
1ALGORITHMIPDIRECT. .
2FEASTOL1E-60.000001000 .
3HESSTYPEFULL. .
4INITDUALFALSE. .
5LOGFREQ11.000000 .
6MAXITER50005000.000000 .
7MAXTIMEII .
8NLPTHREADS(DEFAULT). .
9NTHREADS44.000000 .
10OBJLIMIT1E201E20 .
11OPTTOL1E-60.000001000 .
12PRESERVEINITOFF. .
13SOLTYPE11.000000 .
14TIMETYPEREAL. .


The data set exdm contains the DerivMethods table, which displays the methods of derivative computation, and is shown in Figure 51. The variable names are Label1, cValue1, and nValue1. The rows, which depend on the derivatives used by the solver, specify the method used to calculate each derivative.

Figure 51: DerivMethods ODS Table

DerivMethods

ObsLabel1cValue1nValue1
1Objective GradientAnalytic Formulas.
2Objective HessianAnalytic Formulas.


The data set exss contains the SolutionSummary table and is shown in Figure 52. The variable names are Label1, cValue1, and nValue1. The rows give an overview of the solution, including the solver chosen, the objective value, and the solution status. Depending on the values returned by the solver, the SolutionSummary table might also include some solution quality values such as optimality error and infeasibility. The values in the SolutionSummary table appear in the _OROPTMODEL_ macro variable; each solver chapter has a section that describes the solver’s contribution to this macro variable.

Figure 52: SolutionSummary ODS Table

SolutionSummary

ObsLabel1cValue1nValue1
1SolverNLP.
2AlgorithmInterior Point Direct.
3Objective Functionz.
4Solution StatusOptimal.
5Objective Value22623.34662122623
6  .
7Optimality Error1.844916E-81.844916E-8
8Infeasibility00
9  .
10Iterations1212.000000
11Presolve Time0.000.000047922
12Solution Time0.000.000766


The data set exos contains the OptStatistics table, which displays the optimization statistics, and is shown in Figure 53. The variable names are Label1, cValue1, and nValue1. The rows, which depend on the solver called by PROC OPTMODEL, describe the amount of time and the function evaluations that are used by the solver and associated processing. Times are displayed in seconds of clock or CPU time according to the value of the TIMETYPE= option that is used by the solver.

Figure 53: OptStatistics ODS Table

OptStatistics

ObsLabel1cValue1nValue1
1Function Evaluations1313.000000
2Gradient Evaluations1414.000000
3Hessian Evaluations1212.000000
4Problem Generation Time0.000.000217
5Code Generation Time0.010.005022
6Presolve Time0.000.000047922
7Solution Time0.000.000766
8Total Time0.020.019708


Problem generation is the process of combining the model with the data into a format that solvers can use. This includes computing expression coefficients, but it does not include reading data or evaluating other programming statements. Code generation compiles code for nonlinear expressions in the model and performs other analysis that is needed prior to solver evaluations. The time that is required for problem generation is negligible if the model contains only linear expressions. The presolve time in this table includes the time used by the PROC OPTMODEL presolver and any presolver that is part of the solver. Solution time is the sum of the times used by the presolvers and the solver. The presolve and solution times also appear in the SolutionSummary table. The OptStatistics table includes a total time, which is the sum of times for problem generation, code generation, solution, and overhead in the SOLVE statement. Overhead includes solver setup, postprocessing, and ODS table output.

The Timing table provides an alternate breakdown of SOLVE statement timing. Times in this table are shown in seconds of clock time. The data set exti, which is shown in Figure 54, contains the Timing table data and statistics. The variable names are Label1, cValue1, nValue1, cValue2, and nValue2. The values present depend on the solver and on the context of the SOLVE statement.

Figure 54: Timing ODS Table

Timing

ObsLabel1cValue1nValue1cValue2nValue2
1Problem Generation0.00021696090.000.01207697411.21%
2OPTMODEL Presolver0.00004792210.000.00266755140.27%
3Solver Initialization0.01177310940.010.655341738665.53%
4Code Generation0.0050220490.010.279548772427.95%
5Solver0.00071787830.000.03996018584.00%
6Solver Postprocessing0.00018692020.000.01040477771.04%


Some of the Timing table values have already been described for the OptStatistics table. Solver initialization time is overhead in the SOLVE statement before the solver starts. Solver time includes execution of the solver and its associated preprocessor, if any. Solver postprocessing time is overhead in the SOLVE statement after the solver has completed. Several table values appear only for a SOLVE statement called within a COFOR loop. These values are shown in Table 14.

Table 14: Solver Timing Values for COFOR Loops

Label Description
Waiting for Multiple Threads Time waiting for the required number of threads to become available on the client machine when NTHREADS > 1
Waiting for Grid Time waiting for the distributed computing environment to become ready to accept a new problem
Sending to Grid Time to transmit a solver problem description to the distributed computing environment
Receiving from Grid Time to receive solver results from the distributed computing environment
Waiting after Solver Time between solver completion and the resumption of the SOLVE statement for processing the results
Grid Overhead Time required for processing in the distributed computing environment that is not included in the preceding times


Last updated: March 04, 2026