/***************************************************************************************************************** SAS file name: Binomial_Curves.sas File location: _________________________________________________________________________________________________________________ Purpose: To draw densities and cummulative density curves for three different negative binomial distributions Author: Peter Clemmensen Creation Date: 22/07/2017 This Program supports the Example page "Negative Binomial Distribution" on SASnrd.com *****************************************************************************************************************/ /* Generate Binomial PMF Data */ %let p=0.5; %let n=20; data Binomial_PMF; do k=0 to &n; PMF=pdf('Binomial', k, &p, &n); output; end; run; /* Plot Binomial PMF */ title "Binomial PMF with p=&p and n=&n"; proc sgplot data=Binomial_PMF noautolegend; needle x=k y=PMF / lineattrs=(color=red); xaxis values=(0 to 20) label='k' labelattrs=(size=12 weight=Bold); yaxis display=(nolabel); keylegend / position=NE location=inside across=1 noborder valueattrs=(Size=12 Weight=Bold); run; title;