{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Chapter2

# Chapter2 - Chapter 2 Chapter 2 2.1 SAS Data Summary and...

This preview shows pages 1–4. Sign up to view the full content.

Chapter 2 SAS - 1 - Chapter 2 Data Summary and Other Related Procedures 2.1 PROC MEANS The MEANS procedure provides data summarization tools to compute descriptive statistics for variables across all observations and within groups of observations. For example, PROC MEANS calculates descriptive statistics based on moments estimates quantiles, which includes the median calculates confidence limits for the mean identifies extreme values performs a t test. You have a SAS data set called blood which includes the variables Subject , Gender , AgeGroup , RBC (red blood cells), WBC (white blood cells) and Chol (Cholesterol). This data set has already been created and must be in your SASdata folder. Let us create another SAS program called blood.sas 1. DATA STEP! *The following title will appear as the first line of every page in the output window; title1 'STAT 6360' ; *Input data; data sasdata.blood; infile 'K:\6360\SASdata\blood.txt' ; length Gender \$ 6 BloodType \$ 2 AgeGroup \$ 5 ; input Subject Gender BloodType AgeGroup WBC RBC Chol; label Gender = "Gender" BloodType = "Blood Type" AgeGroup = "Age Group" Chol = "Cholestrol" ; run ; 2. PROC MEANS a. This gives more than just means!

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Chapter 2 SAS - 2 - b. This procedure is a very good example of common statements found in all SAS procedures! c. Basic use of PROC MEANS i. DATA=____ – specify the data set ii. VAR statement – specifies the variables iii. Following is the example SAS code and output: title2 'PROC MEANS summary statistics for blood data set' ; proc means data =SASdata.blood; run ; STAT 6360 PROC MEANS summary statistics for blood data set The MEANS Procedure Variable Label N Mean Std Dev Minimum -------------------------------------------------------------------------- Subject 1000 500.5000000 288.8194361 1.0000000 WBC 908 7042.97 1003.37 4070.00 RBC 916 5.4835262 0.9841158 1.7100000 Chol Cholesterol 795 201.4352201 49.8867157 17.0000000 -------------------------------------------------------------------------- Variable Label Maximum ------------------------------------- Subject 1000.00 WBC 10550.00 RBC 8.7500000 Chol Cholesterol 331.0000000 ------------------------------------- d. Other options in the PROC MEANS line i. There are specific statistic keywords ; for example: (1) N – number of non-missing values (2) NMiss – number of missing values (3) Mean (4) Sum (5) Median (6) Std – Standard deviation (7) Var – Variance (8) Clm – confidence limit for the mean (9) alpha – significance level used in hypothesis tests or confidence intervals (10) probt – p-value for t-test used in H o : μ =0 vs. H a : μ≠ 0 (11) t – test statistic for t-test used in H o : μ =0 vs. H a : μ≠ 0 (12) To perform the above test with the hypothesized value not equal to 0, create a new data set with a new variable: new_variable = old_variable – hyp_value and use PROC MEANS with the new variable.
Chapter 2 SAS - 3 - ii. NOPRINT – no results are printed to the OUTPUT window; may be useful if only want to create an OUTPUT data set only (see below) iii. SAS codes and output to calculate just the specified statistics next: title2 'PROC MEANS - just the mean and the median' ; proc means data =SASdata.blood mean median ; run ; STAT 6360 PROC MEANS - just the mean and the median The MEANS Procedure Variable Label Mean Median ------------------------------------------------------- Subject 500.5000000 500.5000000 WBC 7042.97 7040.00 RBC 5.4835262 5.5200000 Chol Cholesterol 201.4352201 202.0000000 ------------------------------------------------------- title2 'PROC MEANS - adding a VAR statement and requesting specific statistics' ; proc means data =SASdata.blood n nmiss mean median min max ; var

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 24

Chapter2 - Chapter 2 Chapter 2 2.1 SAS Data Summary and...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online