The LOESS Procedure

Output Data Sets

PROC LOESS assigns a name to each table it creates. You can use the ODS OUTPUT statement to place one or more of these tables in output data sets. See the section ODS Table Names for a list of the table names created by PROC LOESS. For detailed information about ODS, see Chapter 20: Using the Output Delivery System.

For example, the following statements create an output data set named MyOutStats containing the Output Statistics table and an output data set named MySummary containing the Fit Summary table.

proc loess data=Melanoma;
   model Incidences=Year;
   ods output OutputStatistics = MyOutStats
              FitSummary       = MySummary;                 
run;

Often, a single MODEL statement describes more than one model. For example, the following statements fit eight different models (four smoothing parameter values for each dependent variable).

 
proc loess;
   model y1 y2 = x1 x2 x3/smooth =0.1 to 0.7 by 0.2;
   ods output OutputStatistics = MyOutStats;                 
run;

The eight Output Statistics tables for these models are stacked in a single data set called MyOutStats. The data set contains a column named DepVarName and a column named SmoothingParameter that distinguish each model (see Figure 53.8 for an example). If you want the Output Statistics table for each model to be in its own data set, you can use the MATCH_ALL option in the ODS OUTPUT statement. The following statements create eight data sets named MyOutStats, MyOutStats1, …, MyOutStats7.

 
proc loess;
   model y1 y2 = x1 x2 x3/smooth =0.1 to 0.7 by 0.2;
   ods output OutputStatistics(match_all) = MyOutStats;                 
run;

For further options available in the ODS OUTPUT statement, see Chapter 20: Using the Output Delivery System.

Only the Scale Details and Fit Summary tables are displayed by default. The other tables are optionally displayed by using the DETAILS option in the MODEL statement and the PRINT option in the SCORE statement. Note that it is not necessary to display a table in order for that table to be used in an ODS OUTPUT statement. For example, the following statements display the Output Statistics and k-d Tree tables but place the Output Statistics and Prediction at Vertices tables in output data sets.

 
proc loess data=Melanoma;
   model Incidences=Year/details(OutputStatistics kdTree);   
   ods output OutputStatistics = MyOutStats
              PredAtVertices   = MyVerticesOut;                 
run;

Using the DETAILS option alone causes all tables to be displayed.

The MODEL statement options CLM, RESIDUAL, STD, SCALEDINDEP, and T control which optional columns are added to the OutputStatistics table. For example, to obtain an OutputStatistics output data set containing residuals and confidence limits in addition to the model variables and predicted value, you need to specify the RESIDUAL and CLM options in the MODEL statement as in the following example:

 
proc loess data=Melanoma;
   model Incidences=Year/residual clm;   
   ods output OutputStatistics = MyOutStats;                 
run;

Finally, note that using the ALL option in the MODEL statement causes all optional columns to be included in the output. Also, ID columns can be added to the OutputStatistics table by using the ID statement.