We're going to begin to visualize our variables with graphs. While we start with graphing one variable at a time, we'll use this as a springboard for ultimately visualizing multiple multiple variables simultaneously within our graphs. Bar charts are most commonly used to examine the distribution of individual variables. Here we show the distribution for the random sample of 1,200 US college students who were asked, what is your perception of your own body? In this bar chart, the X, or horizontal axis, includes the three response categories, underweight, overweight, and about right. In the first bar chart, the height of the bars is measured on the Y, or vertical axis. As the number of college students giving each response. The second bar chart, shows the same data. But, as a percentage of the total sample. A bar chart helps us display the distribution of a categorical variable, for example a percentage of observations in each category. If you'll recall, the data manage variables of interest in our sample project are now TAB12MDX, representing a diagnosis of nicotine dependence in the past 12 months. And NUMCIGMO_EST representing the average number of cigarettes smoked per month. We're going to comment out some of the data analysis syntax following the PROC source statement and leave only those two variables and the table statement. If we run the program, the output will, of course, include frequency distributions for these two variables. However, in addition to frequency distributions, we now want to examine corresponding bar charts for these two variables. The bar chart is one the most frequently used graphic visualizations in SAS. We will use the G chart procedure to produce them. We're going to keep it simple. We will use SAS code to generate graphs that help us learn more about our data and to make decisions about next steps in our research. We're focusing on the function of graphic visualizations, rather than producing polished, presentation ready graphs. Categorical variables can be visualized one at a time with univariate graphs, that is with single variable bar charts. Here's the basic code for univariate graph, the categorical variable. PROC GCHART; VBAR categorical variable/Discrete type=PCT width=30; VBAR tells SAS to generate a vertical bar chart. A chart with the bars displayed vertically. Next, you type your categorical variable name. In this case, TAB12MDX, followed by a forward slash and the word discrete. Discrete is an alternate term for categorical. This section of the syntax is telling SAS that the named variable is a categorical variable. Type=PCT is telling SAS to generate a graph using percentages, rather than raw numbers. That is, the percentage of observations in each level of the named categorical variable. Width = 30 is code telling SAS to generate a chart with bars 30 units wide. You can definitely adjust the width size to suit your needs. Try with equals to 25 or 15 and see how the look of the graph changes. And of course, the statement ends with a semicolon. Here is the prop G chart code inserted in our sample program. And we just save and run the program to generate the requested bar charts. Here's the bar chart we told SAS to generate. It shows the percent of young adult smokers with nicotine dependence, about 52.5%, as indicated by the response code of one. And those without nicotine dependence, about 47.5%, indicated by a zero. Now, we'll graphically display the frequency distribution for the smoking variable. That is, the estimated number of cigarettes smoked per month. NUMCIGMO_EST. Because NUCIGMO_EST, which is the estimate for the number of cigarettes smoked per month, is actually a quantitative variable, the syntax we use in the SAS program is slightly different. To visualize a quantitative variable, you would include, PROC GCHART; VBAR quantitative variable, which in this case is NUMCIGMO_EST/ type=PCT;. When you run this, you'll see that SAS generates a graphical distribution of a quantitative variable around its midpoint, or median. SAS generates a histogram. In a histogram, intervals of values are plotted on the x-axis, rather than discrete or separate values. From the bars here, you can see that what is displayed is the midpoint of the intervals. Typically, we don't specify the width of the bars for quantitative variable. A SAS will create a display that best represents the distribution.