/***************************************************************************************************************** SAS file name: Cont_Dist_Fitting.sas File location: _________________________________________________________________________________________________________________ Purpose: Fit continuous distributions to univariate data using PROC UNIVARIATE Author: Peter Clemmensen Creation Date: 10/07/2017 This program supports the blog post "Fitting Continuous Distributions to Univariate Data" on SASnrd.com *****************************************************************************************************************/ /* Fitting Normal, Lognormal and Weibull dist to mpg_city variable in sashelp.cars */ ods select Histogram QQplot GoodnessOfFit; /* Select only the relevant output */ proc univariate data=sashelp.cars; histogram mpg_city/ normal weibull(theta=est) /* Default is theta = 0 */ lognormal(theta=est) midpoints = 4 to 62 by 2 odstitle = "Assesing Distribution Using Proc Univariate"; qqplot mpg_city / normal(mu=est sigma=est) odstitle = "Normal QQ Plot"; qqplot mpg_city / weibull(c=est sigma=est theta=est) odstitle = "Weibull QQ Plot"; qqplot mpg_city / lognormal(sigma=est theta=est zeta=est) odstitle = "LogNormal QQ Plot"; run; /* Select best fitting distribution of the predefined distributions in the PROC SEVERITY */ ods select ModelSelection CDFPlot PDFPlot; proc severity data = sashelp.cars; loss mpg_city; dist _PREDEFINED_; run;