Unformatted text preview:

Introduction to Tables and Graphs in SAS 1 Descriptive statistics are valuable as analytical tools and in developing data in the introduction we went over basic reporting commands frequencies PROC FREQ univariate statistics PROC MEANS and PROC UNIVARIATE correlations PROC CORR this class will discuss these routines in more detail focusing on how to produce simple tables and cross tabulations conditional tables of statistics introduce a general tabulation procedure PROC TABULATE discuss some plotting and graphing procedures 2 Printing information from a data set the simplest reporting procedure is PROC PRINT which prints the values from a data set the syntax for this procedure is PROC PRINT option list VAR variable list this procedure is helpful for analyzing modestly sized data sets you need to be careful not to call this procedure with large data sets such as the PSID because the resulting output can overwhelm the OUTPUT window the VAR statement will help to control the width of the output data set options and general options are two ways to control the length of the output 3 Univariate statistics in empirical analyses we often include a table of univariate statistics to document the data set we also want to be sure that the measures that we are using have reasonable values and distributions e g all the values are in range some variation in the values we can use the MEANS and UNIVARIATE procedures to generate these statistics the advantage of these procedures is that they produce a great deal of standard output with very few commands PROC MEANS the syntax of the PROC MEANS statement is PROC MEANS option list statistic keyword list if you don t specify any statistic keywords the default the MEANS procedure reports the number of non missing values means standard deviations minimum values and maximum values for all of the variables in your data set or all of the variables listed in an accompanying VAR statement you can also specify alternative statistics such as the median MEDIAN the sum SUM variance VAR standard error STDERR and coefficient of variation CV a complete list 1 is available at http support sas com documentation cdl en proc 59565 HTML default a000146729 htm the MEANS procedure generally outputs one line per variable however it may output multiple lines if your variables are labeled or if you request lots of statistics PROC UNIVARIATE the syntax for the PROC UNIVARIATE statement is PROC UNIVARIATE option list although it is not required it is a good idea to include a VAR statement specifying the variables for which statistics will be generated the main difference between the UNIVARIATE and MEANS procedures is that the UNIVARIATE procedure estimates many more statistics usually 1 2 pages per variable to produce simple distributions of categorical variables we can use the FREQuency procedure the syntax for a univariate distribution is PROC FREQ TABLE row var where row var is the categorical variable this will produce a table with rows containing the numbers percentages cumulative numbers and cumulative percentages of observations in each category of row var 4 Two way cross tabulations cross tabulations are tables of statistics that are computed conditionally for example in an empirical analysis we might want to list simple descriptive statistics or distributions of variables for separate sub samples of our larger analysis sample e g list results separately for women and men or separately by ethnicity many statistical procedures in SAS have simple commands that allow for conditional processing PROC FREQ in a previous lecture we showed how the FREQuency procedure could be used to produce two way tables the syntax is PROC FREQ TABLE row var col var options this will produce a two way table with cells corresponding to each possible combination of row var and col var be careful in your table requests you generally want to avoid using this with variables with lots of different outcomes especially continuous variables note if needed you can specify formats to control the display of continuous variables 2 also to minimize output you generally want to use the row variable to be variable with the most potential outcomes in the output each cell will contain the cell frequency the number of observations in that cell the table percentage cell observations as a percent of all non missing observations in the dataset the row percentage cell observations as a percent of observations with a given value of row var and the column percentage cell observations as a percent of observations with a given value of col var options can be specified to suppress the calculation of some of these statistics NOFREQ suppresses the printing of cell frequencies NOPERCENT suppresses the printing of table percentages NOROW suppresses the printing of row percentages NOCOL suppresses the printing of column percentages you can also request formal statistics of the association between the row and column variables such as the Pearson and Spearman correlation coefficients the general option for these is MEASURES unless you specify otherwise the FREQuency procedure ignores missing values if you would like missing values to be included as an additional category include the MISSING option the CLASS statement in the MEANS and UNIVARIATE procedures the MEANS and UNIVARIATE procedures also will produce conditional statistics in newer versions of SAS this can be done using a CLASS statement the syntax for this statement is CLASS variable list with this the procedures will calculate statistics for subgroups defined by the CLASS variables if there is just one CLASS variable the procedures will calculate statistics for each different value if there are two CLASS variables the procedures will calculate statistics for each observed combination of values for example suppose that you had a data set with two categorical variables gender and education PROC MEANS CLASS gender education produces simple descriptive statistics for each combination in the cross product gender x education tests of differences of means the TTEST procedure when we calculate conditional means and other statistics we are often interested in formally testing whether these statistics differ across groups 3 the TTEST procedure tests for differences in means and variances across two groups the syntax is PROC TTEST VAR variable list CLASS class var the CLASS variable needs to be restricted to two outcomes if the VAR statement is omitted TTEST calculates tests


View Full Document

UNCG ECO 725 - Introduction to Tables and Graphs in SAS

Loading Unlocking...
Login

Join to view Introduction to Tables and Graphs in SAS and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Introduction to Tables and Graphs in SAS and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?