Published on :

Descriptive Analysis and Normality Tests on Baseball Data

This code is also available in: Deutsch Español Français
Awaiting validation
The program loads data from SASHELP.BASEBALL into the temporary library. It then performs several successive univariate analyses: normality tests on runs (nRuns), generation of descriptive graphs, and calculation of basic confidence intervals with hypothesis testing (mu0=100) for hits (nHits). Specific percentiles are exported to an output table.
Data Analysis

Type : SASHELP


Data is sourced from the standard SASHELP library, BASEBALL table, copied locally to the WORK.BASEBALL table.

1 Code Block
DATA STEP Data
Explanation :
Copies the source table SASHELP.BASEBALL to the temporary table WORK.BASEBALL for local manipulation.
Copied!
1DATA baseball;
2 SET sashelp.baseball;
3RUN;
2 Code Block
PROC PRINT
Explanation :
Displays the content of the baseball table in the standard output.
Copied!
1PROC PRINT DATA=baseball;
2RUN;
3 Code Block
PROC UNIVARIATE
Explanation :
Executes the UNIVARIATE procedure with the NORMAL option to perform normality tests on the 'nRuns' variable.
Copied!
1 
2PROC UNIVARIATE
3DATA=baseball normal;
4var nRuns;
5RUN;
6 
4 Code Block
PROC UNIVARIATE
Explanation :
Generates statistical graphs (histograms, box plots, QQ-plots) for the 'nRuns' variable.
Copied!
1 
2PROC UNIVARIATE
3DATA=baseball plot;
4var nRuns;
5RUN;
6 
5 Code Block
PROC UNIVARIATE
Explanation :
Combines PLOTS and NORMAL options to simultaneously obtain graphs and normality tests on 'nRuns'.
Copied!
1 
2PROC UNIVARIATE
3DATA=baseball plots normal;
4var nRuns;
5RUN;
6 
6 Code Block
PROC UNIVARIATE Data
Explanation :
Analyzes the 'nHits' variable with basic confidence intervals (CIBASIC) and tests the hypothesis mean=100 (MU0=100). Creates an output table 'stats' containing the 33.3 and 66.7 percentiles.
Copied!
1PROC UNIVARIATE DATA=baseball cibasic mu0=100;
2 var nHits;
3 OUTPUT out=stats pctlpts=33.3 66.7;
4RUN;
7 Code Block
PROC PRINT
Explanation :
Second display of the content of the baseball table.
Copied!
1PROC PRINT DATA=baseball;
2RUN;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.