Search code examples
sasdistribution

Is there a way to print Proc Univariate output for Fitted distribution?


I have a dataset of observed data and I want to test if they are ~ LogNormal (μ;σ)

I have used the following:

Proc Univariate data=myData;
var Var1;
histogram / LogNormal;
run;

I have, as an output, different tables and I would like to store in a Table the results of the "Parameters for Lognormal Distribution".

Parameters for Lognormal Distribution (Example)

Parameter Symbol Estimate
Threshold Theta 0
Scale Zeta 9.09
Shape Sigma 1.04

However, it seems to me that I can only store basics statistics (e.g. normality test, skewness test)

Anyone may help?

Thanks in advance!


Solution

  • Enable ODS Trace and you can find the table that stores this information, then output it with ods output. For example:

    ods trace on;
    proc univariate data=sashelp.cars;
        var horsepower;
        histogram / lognormal;
    run;
    ods trace off;
    

    Check the log and you'll see:

    Output Added:
    -------------
    Name:       ParameterEstimates
    Label:      Parameter Estimates
    Template:   base.univariate.FitParms
    Path:       Univariate.Horsepower.Histogram.Lognormal.ParameterEstimates
    -------------
    

    Use ods output to grab the parameter estimates and save them to a table:

    proc univariate data=sashelp.cars;
        var horsepower;
        histogram / lognormal;
        ods output ParameterEstimates;
    run;
    
    VarName     Histogram   Distribution    Parameter   Symbol  Estimate
    Horsepower  1           Lognormal       Threshold   Theta   0
    Horsepower  1           Lognormal       Scale       Zeta    5.321345
    Horsepower  1           Lognormal       Shape       Sigma   0.328634
    Horsepower  1           Lognormal       Mean                216.0145
    Horsepower  1           Lognormal       Std Dev             72.95021