Hey everyone,
I am attempting to use proc npar1way between 7 groups. I would like to see the Kruskal-Wallis results between all groups (A through G), and want to analyze each group against each other (A against B, A against C, A against D, and so on). I'm okay with the first part, but I cannot figure out how to test each group against each other without having to retype each group. I've tried using the 'where' statement that the SAS guide suggests, but I may not be doing it correctly. Can anyone help?
Thanks for your time.
Here is a section of my SAS code:
data Cyperus_all_herbicides;
title1 'Cyperus Preserved All Herbicides';
input Herbicide$ Alive @@;
datalines;
control 0 control 0 control 0 control 0 control 0 control 0 control 20 control 0 control 0 control 40 control 5 control 10 control 0 control 0 control 0 control 0 control 20 control 0 control 0 control 0 control 0 control 0 control 0 control 0 control 0 control 0 control 20 control 0 control 0 control 40 control 5 control 10 control 0 control 0 control 0 control 0 control 20 control 0 control 0 control 0 control 0 control 0 control 0 control 0 control 0 control 0 control 25 control 0 control 0 control 20 control 0 control 0 control 0 control 0 control 0 control 0 control 50 control 85 control 0 control 60
str 0 str 0 str 0 str 0 str 0 str 0 str 0 str 0 str 5 str 0 str 10 str 40 str 25 str 0 str 0 str 0 str 0 str 0 str 0 str 0 str 0 str 0 str 0 str 0 str 0 str 0 str 0 str 0 str 5 str 0 str 10 str 40 str 25 str 0 str 0 str 0 str 0 str 0 str 0 str 0 str 0 str 0 str 0 str 0 str 0 str 0 str 0 str 0 str 0 str 5 str 0 str 0 str 100 str 30 str 20 str 25 str 50 str 10 str 0 str 10
td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0 td1 0
td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 10 td2 0 td2 0 td2 0 td2 0 td2 0 td2 0 td2 20 td2 40 td2 25
tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 10 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 10 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 0 tri1 20 tri1 0 tri1 0 tri1 0 tri1 20 tri1 0 tri1 20
tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 0 tri2 10 tri2 0 tri2 0 tri2 20 tri2 0 tri2 30 tri2 20 tri2 10 tri2 20
view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 0 view 5 view 0 view 0 view 20 view 0 view 0 view 0 view 10 view 0 view 0
;
run;
proc npar1way data=Cyperus_all_herbicides;
where herbicide = Control and Str;
class herbicide;
var Alive;
run;
Here is the log:
NOTE: The data set WORK.CYPERUS_ALL_HERBICIDES has 420 observations and 2
variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
387 ;
388 run;
389 proc npar1way data=Cyperus_all_herbicides;
390 where herbicide = Control and Str;
ERROR: Variable Control is not on file WORK.CYPERUS_ALL_HERBICIDES.
391 class herbicide;
392 var Alive;
393 run;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE NPAR1WAY used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
Since HERBICIDE is a character variable, you need to use quatation marks to enclose the values in the WHERE statement.
Try this:
WHERE herbicide = "control" or herbicide = "str";
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.