Changing the Graph Properties for a Histogram By default, a histogram in SAS Enterprise has 10 bins and is scaled to show the entire range of data. Use these steps to change the number of bins in a histogram and change the range of the axes. While the default bin size is sufficient to show the general shape of a variable’s distribution, it is sometimes useful to increase the number of bins to improve the histogram’s resolution. Right-click in the data area of the histogram and select Graph Properties… from the Option Age menu. The Properties-Histogram window opens. This window enables you to change the appearance of your charts. For histograms, the most important appearance property (at least in a statistical sense) is the number of bins. Type into the field. 87 Number of X Bins Because is integer-valued and the original distribution plot had a maximum of 87, there will be Age one bin per possible value. Age Select OK. The Explore window reopens and shows many more bins in the histogram. Age With the increase in resolution, unusual features become apparent in the variable. For example, Age there are unexpected spikes in the histogram at 10-year intervals, starting at Age=7. Also, you must question the veracity of ages below 18 for donors to the charity. Adding to the Explore Window You can add other plots to the Explore window. Follow these steps to add a pie chart of the target variable. Select from the Explore window menu. The Chart wizard opens to the Select a Chart Actions Plot Type step. Scroll down in the chart list and select a Pie chart. Select Next >. The Chart wizard continues to the Select Chart Roles step. The message at the top of the Select Chart Roles window states that a variable must be assigned the Category role. Scroll the variable list and select Role Category for the TargetB variable. Again, skip over the data filtering option and click Finish. Select Finish to create the pie for TargetB. The chart shows an equal number of cases for (top) and (bottom). TargetB=0 TargetB=1
Changing the Graph Properties for a Histogram By default, a histogram in SAS Enterprise has 10 bins and is scaled to show the entire range of data. Use these steps to change the number of bins in a histogram and change the range of the axes. While the default bin size is sufficient to show the general shape of a variable’s distribution, it is sometimes useful to increase the number of bins to improve the histogram’s resolution. Right-click in the data area of the Age histogram and select Graph Properties… from the Option menu. The Properties-Histogram window opens. This window enables you to change the appearance of your charts. For histograms, the most important appearance property (at least in a statistical sense) is the number of bins. Type 87 into the Number of X Bins field. Because Age is integer-valued and the original distribution plot had a maximum of 87, there will be one bin per possible Age value. Select OK. The Explore window reopens and shows many more bins in the Age histogram. With the increase in resolution, unusual features become apparent in the Age variable. For example, there are unexpected spikes in the histogram at 10-year intervals, starting at Age=7. Also, you must question the veracity of ages below 18 for donors to the charity. Adding to the Explore Window You can add other plots to the Explore window. Follow these steps to add a pie chart of the target variable. Select Actions Plot from the Explore window menu. The Chart wizard opens to the Select a Chart Type step. Scroll down in the chart list and select a Pie chart. Select Next >. The Chart wizard continues to the Select Chart Roles step. The message at the top of the Select Chart Roles window states that a variable must be assigned the Category role. Scroll the variable list and select Role Category for the TargetB variable. Again, skip over the data filtering option and click Finish. Select Finish to create the pie for TargetB. The chart shows an equal number of cases for TargetB=0 (top) and TargetB=1 (bottom).
In-Class-Exercise-Getting-Familiar-with-SAS-v2.docx