Professor of Anthropology Bruce Hardy makes headlines for his study on the cognitive abilities of Neanderthals. Kenyon alumni working in food and drink industries are sharing their go-to happy hour pairings. Interested in making videos for your class projects or lectures? The correct bibliographic citation for this manual is as follows: Cody, Ron. For a hard-copy book: No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, or otherwise, without the prior written permission of the publisher, SAS Institute Inc.
For a Web download or e-book: Your use of this publication shall be governed by the terms established by the vendor at the time you acquire this publication.
The scanning, uploading, and distribution of this book via the Internet or any other means without the permission of the publisher is illegal and punishable by law. Please purchase only authorized electronic editions and do not participate in or encourage electronic piracy of copyrighted materials.
Government Restricted Rights Notice: Use, duplication, or disclosure of this software and related documentation by the U. Other brand and product names are registered trademarks or trademarks of their respective companies. Program 1. Program 2. Read more Show all links. Allow this favorite library to be seen by others Keep this favorite library private. Find a copy in the library Finding libraries that hold this item SAS statistics by example. Cary, N. Find more information about: Ronald P Cody.
Reviews User-contributed reviews Add a review and share your thoughts with other readers. Be the first. Add a review and share your thoughts with other readers.
Start your free trial. The QUIT statement ends the procedure. Here is the output from Program 3. A number of built-in styles make it very easy to customize your output. You enter the keyword VBAR, followed by one or more variables for which you want to create a bar chart. Following the procedure, you close the destination using another ODS statement.
The PDF file that was created by Program 3. Following this, you specify the two variables of interest, separated by an asterisk. For example, the store data set contains the variables Region and Gender. If you want to see the distribution of Gender across all values of Region, you proceed with Program 3. In this example, Gender will form the rows of the table, and Region will form the columns.
Chapter 3 Descriptive Statistics — Categorical Variables 53 Each box in the table contains four values; the meaning of these values is found in the key in the upper-left corner of the table. As you can see, the top number in each box is the number of observations. For example, there are 22 females in the Eastern region. The next number is a percentage.
Finally, the fourth number in each box is a column percentage; Notice the order of the rows and columns in the output. By default, SAS orders the rows and columns in a table or for a single variable by the internal value of the variable— alphabetically for character variables and numerically for numeric variables.
Changing the Order of Values in a Frequency Table Whether you have a one-way or a two-way table, you might want to control the order that SAS uses for the rows, the columns, or both. Or you might be computing an odds ratio in a 2x2 table and want the first column to be labeled Yes and the second column to be labeled No.
You can accomplish these goals in several ways. One is to create a new variable from the existing variable, where the internal values are in the desired order. Another, easier, method is to associate formats that are in the target order and associate that format with your variable. The example that follows uses this method to force the order of the regions to be North, East, South, and West. First the program, then the explanation. Note that the digits 1, 2, 3, and 4 are part of the format labels, and 1 comes before 2 alphabetically, etc.
Remember that the association is made by the FORMAT statement, not because the name of the format is similar to the name of the variable. Because female comes before male alphabetically, the order is Female, then Male. Conclusions In this chapter, you learned how to display values of categorical variables, both in tabular and graphical form.
Although you can use several methods to change the order of rows and columns in a table, using formats might be the simplest. You also learned how to use the built-in styles to create attractive output with a minimum of effort.
The next chapter finishes up our discussion of descriptive statistics by showing you how to produce numerical and graphical displays for bivariate relationships. Descriptive Statistics — Bivariate Associations 4 Introduction First are simple scatter plots that were produced with several different procedures. The next section in this chapter shows you how to produce scatter plots using the newer SGPLOT procedure, which is the recommended method for making scatter plots.
By supplying a few graphics options, you can control the appearance of the plot. Program 4. Without this statement, the procedure uses the default plotting symbol, a plus sign. You specify the variables to be plotted, using a PLOT statement. Chapter 4 Descriptive Statistics — Bivariate Associations 59 You can include spaces before and after the asterisk if you want or you can leave them out—your choice.
Here is the plot: Suppose you want to see this same plot, but with Gender identified. You can modify your plot to include Gender information like this: Program 4. Because graphics options stay in effect until you change them, it is a good idea to reset all the graphics options back to their default values before producing a new graph. All titles stay in effect until you change or cancel them. For example, if you were to write a new program following Program 4.
Each unique value of Gender will be displayed with a different plotting symbol. Looking at the output should make this clear. In particular, look at the legend below the scatter plot. You can specify the x and y variables in any order. This program produces the following output: The plotting symbols on this plot are circles the default symbol. For example, if you want filled-in triangles as plotting symbols, you could request them like this: Cody, Ron.