Search code examples
sasregressionodssas-studio

proc transreg not outputting curve fit plot


I am using proc transreg to test different transformations in the sashelp.baseball dataset. I request all plots and sometimes I can see a curve fit graph and sometimes I can't. Is there something I am missing if I want to output the regression fit with the code below?

DATA BASEBALL;
    SET SASHELP.BASEBALL;
RUN;

ODS GRAPHICS ON;
ODS OUTPUT
    NObs = num_obs
    FitStatistics = fitstat
    Coef = params
    ;
PROC TRANSREG
    DATA=BASEBALL
    PLOTS=ALL
    SOLVE
    SS2
    PREDICTED;
    ;
    MODEL_1:
        MODEL POWER(logsalary/parameter=1) = log(nruns);
            OUTPUT OUT = fitted_model;
RUN;

For clarity, the regression fit plot is a scatter plot with the estimated regression line fitted through


Solution

  • The fit plot is generated when the dependent variable does not have a transformation. You can create the transformation ahead of time to get this graph then.

    From documentation:

    ODS Graph Name: FitPlot

    Plot Description: Simple Regression and Separate Group Regressions

    Statement and Option: MODEL, a dependent variable that is not transformed, one non-CLASS independent variable, and at most one CLASS variable

    This code works for me:

    PROC TRANSREG
        DATA=sashelp.BASEBALL
        PLOTS=ALL
        SOLVE
        SS2
        PREDICTED;
        ;
        MODEL_1:
            MODEL identity(logsalary) = log(nruns);
                OUTPUT OUT = fitted_model;
    RUN;
    

    And generates the desired graph.

    enter image description here