50 likes | 230 Views
There are several PROCs that we can use at this stage in their “default” mode (later we’ll work with many of their options): PROC SORT; to rearrange data PROC PRINT; to print out data PROC MEANS; to compute simple descriptive statistics of numeric variables
E N D
There are several PROCs that we can use at this stage in their “default” mode (later we’ll work with many of their options): • PROC SORT; to rearrange data • PROC PRINT; to print out data • PROC MEANS; to compute simple descriptive statistics of numeric variables • PROC FREQ; to compute frequency distributions and cross tabulations of categorical variables
SORT PROC SORT DATA=datasetname; BY variable1 … variablen; • PRINT PROC PRINT DATA=datasetname; • MEANS PROC MEANS DATA=datasetname; • FREQ PROC FREQ DATA=datasetname; TABLES variable_combinations; Check out support.sas.com and look for the “documentation” link…
SORT PROC SORT DATA=datasetname; BY variable1 … variablen; • The BY statement is required for this procedure and gives the name of the variable(s) on which the ordering is to be based. In other procedures, the BY statement is optional and indicates that the PROC is to perform a separate analysis for each combination of levels of the BY-variables instead of as a whole group. • When doing a PROC by a variable, the dataset must first be SORTed BY that variable - this is one of the main uses of PROC SORT; Let’s do some examples…
Open SAS and read in the “diet program” data… • Show the many ways PROC SORT can be used with this data… note that SORT does not print automatically - you must use PROC PRINT to see the results of your SORTing… • Try PROC MEANS & PROC FREQ on this data too to see the results… • Try these PROCs on BY groups; that is, SORT the data BY an appropriate variable and then do the other PROCs BY that variable and notice the different results that are possible. • HW: Use Dr. Padgett’s data and practice SORT, PRINT, MEANS, and FREQ. This material can be found in various sections of Chapter 4…