I am using this code:
PROC NPAR1WAY data=Temp wilcoxon median;
Class Group;
Var POwnPriceElasticity;
output out=NPAR1WAY;
Run;
to compare the medians of 2 groups. Just curious, if I have a value for PL_MED or PR_MED, how do I know the directionallity of this? Does SAS base this on the alphabetic order of the groups? Hope this makes sense ...
Not the alphabetic order is relevant, but the size of the groups (smaller group prioritized) and in case of equal group sizes the observation order in the input dataset.
To quote the documentation:
"To compute the linear rank statistic S, PROC NPAR1WAY sums the scores of the observations in the smaller of the two samples. If both samples have the same number of observations, PROC NPAR1WAY sums those scores for the sample that appears first in the input data set."
(The decision between left- and right-sided test is, of course, based on whether S is greater than (--> right-sided) or less than (--> left-sided) its expected value under the null hypothesis; in case of equality: left-sided test.)
Edit: Just to avoid any misconceptions: The abovementioned "decision between left- and right-sided test" refers to which of the two variables PL_MED and PR_MED in the output dataset is populated, not to the appropriateness of these statistical tests.
Not the alphabetic order is relevant, but the size of the groups (smaller group prioritized) and in case of equal group sizes the observation order in the input dataset.
To quote the documentation:
"To compute the linear rank statistic S, PROC NPAR1WAY sums the scores of the observations in the smaller of the two samples. If both samples have the same number of observations, PROC NPAR1WAY sums those scores for the sample that appears first in the input data set."
(The decision between left- and right-sided test is, of course, based on whether S is greater than (--> right-sided) or less than (--> left-sided) its expected value under the null hypothesis; in case of equality: left-sided test.)
Edit: Just to avoid any misconceptions: The abovementioned "decision between left- and right-sided test" refers to which of the two variables PL_MED and PR_MED in the output dataset is populated, not to the appropriateness of these statistical tests.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.