Fitting a Beta Curve on a Histogram

/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: CAPBTA2                                             */
/*   TITLE: Fitting a Beta Curve on a Histogram                 */
/* PRODUCT: QC                                                  */
/*  SYSTEM: ALL                                                 */
/*    KEYS: Capability Analysis, Beta Distribution,             */
/*   PROCS: CAPABILITY                                          */
/*    DATA:                                                     */
/*                                                              */
/* SUPPORT: saswgr                                              */
/*     REF: PROC CAPABILITY, HISTOGRAM Example 1                */
/*    MISC:                                                     */
/*                                                              */
/****************************************************************/

data Measures;
   input Length @@;
   label Length = 'Attachment Point Offset in mm';
   datalines;
10.147 10.070 10.032 10.042 10.102
10.034 10.143 10.278 10.114 10.127
10.122 10.018 10.271 10.293 10.136
10.240 10.205 10.186 10.186 10.080
10.158 10.114 10.018 10.201 10.065
10.061 10.133 10.153 10.201 10.109
10.122 10.139 10.090 10.136 10.066
10.074 10.175 10.052 10.059 10.077
10.211 10.122 10.031 10.322 10.187
10.094 10.067 10.094 10.051 10.174
;

ods graphics off;
legend2 frame cframe=ligr cborder=black position=center;
title1 'Fitted Beta Distribution of Offsets';
proc capability data=Measures;
   specs usl=10.25 lusl=20 cusl=salmon cright=yellow pright=solid;
   histogram Length /
      beta(theta=10 scale=0.5 color=blue fill)
      cfill     = ywh
      cframe    = ligr
      href      = 10
      hreflabel = 'Lower Bound'
      lhref     = 2
      legend    = legend2
      vaxis     = axis1;
   axis1 label=(a=90 r=0);
   inset n = 'Sample Size'
         beta(pchisq = 'P-Value') / pos=ne  cfill=ywh;
run;