1 / 4

SORT PROC SORT DATA=datasetname; BY variable1 … variablen; PRINT PROC PRINT DATA=datasetname;

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

jada
Télécharger la présentation

SORT PROC SORT DATA=datasetname; BY variable1 … variablen; PRINT PROC PRINT DATA=datasetname;

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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

  2. 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…

  3. 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…

  4. 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…

More Related