Published on :
Statistics CREATION_INTERNE

Non-parametric Analysis with PROC NPAR1WAY

This code is also available in: Deutsch Español Français
Awaiting validation
The script begins by creating a dataset named 'Gossypol' via a DATA STEP, using data embedded directly in the script ('datalines'). This dataset contains the variables 'Dose' and 'Gain'. Subsequently, the PROC NPAR1WAY procedure is called three times for different analyses:
1. The first execution performs a general non-parametric analysis to compare 'Gain' based on 'Dose'.
2. The second execution, framed by 'ods graphics on' and 'ods graphics off', generates a box plot of Wilcoxon scores to visualize distributions.
3. The third execution of PROC NPAR1WAY performs a two-sample analysis, applying a 'where Dose <= .04' clause to filter the data and focus on a specific subset. The entire script is designed to demonstrate various applications of PROC NPAR1WAY in experimental data analysis.
Data Analysis

Type : CREATION_INTERNE


The data is created directly within the SAS script via a DATA STEP using the 'datalines' feature to define observations for the 'Dose' and 'Gain' variables.

1 Code Block
DATA STEP Data
Explanation :
This DATA STEP block creates the 'Gossypol' dataset. It first reads a 'Dose' and a number 'n' of observations. Then, a loop reads 'n' 'Gain' values for each 'Dose', assigns them, and writes them to the dataset. The data is provided directly in the script via the 'datalines' section.
Copied!
1DATA Gossypol;
2 INPUT Dose n;
3 DO i=1 to n;
4 INPUT Gain;
5 OUTPUT;
6 END;
7 DATALINES;
80 16
9228 229 218 216 224 208 235 229 233 219 224 220 232 200 208 232
10.04 11
11186 229 220 208 228 198 222 273 216 198 213
12.07 12
13179 193 183 180 143 204 114 188 178 134 208 196
14.10 17
15130 87 135 116 118 165 151 59 126 64 78 94 150 160 122 110 178
16.13 11
17154 130 130 118 118 104 112 134 98 100 104
18;
2 Code Block
PROC NPAR1WAY
Explanation :
This PROC NPAR1WAY performs a one-way non-parametric analysis. It compares the distribution of the 'Gain' variable among the different groups defined by the 'Dose' variable in the 'Gossypol' dataset.
Copied!
1PROC NPAR1WAY DATA=Gossypol;
2 class Dose;
3 var Gain;
4RUN;
3 Code Block
PROC NPAR1WAY
Explanation :
This block uses PROC NPAR1WAY to generate a box plot specific to Wilcoxon scores. The 'ods graphics on' and 'ods graphics off' statements enable and disable the graphical output of the Output Delivery System (ODS).
Copied!
1ods graphics on;
2PROC NPAR1WAY DATA=Gossypol plots(only)=wilcoxonboxplot;
3 class Dose;
4 var Gain;
5RUN;
6ods graphics off;
4 Code Block
PROC NPAR1WAY
Explanation :
This PROC NPAR1WAY performs a non-parametric analysis on a subset of the 'Gossypol' data. The 'where Dose <= .04' clause filters observations, including only those where the 'Dose' value is less than or equal to 0.04, allowing a targeted analysis on these groups.
Copied!
1PROC NPAR1WAY DATA=Gossypol;
2 where Dose <= .04;
3 class Dose;
4 var Gain;
5RUN;
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.
Copyright Info : SAS SAMPLE LIBRARY