Programming the statistical procedures from SAS

Monte Carlo p-value for Wilcoxon test (NPAR1WAY)

Reply
N/A
Posts: 1

Monte Carlo p-value for Wilcoxon test (NPAR1WAY)

I’m running a Wilcoxon rank sum test and I want to output a table containing the 2-sided Monte Carlo p-value (the variable name is MCP2_WIL). I don’t want to use the ODS OUTPUT statement because the result is not given in a friendly format (it looks like this: “<.0001”). I want the exact numeric value. When I use the OUTPUT OUT statement the output table is not including MCP2_WIL:

PROC NPAR1WAY DATA =WORK.test_data Wilcoxon;

CLASS group;               

VAR response;

EXACT Wilcoxon /MC;

OUTPUT OUT=WORK.Wilcoxon_output Wilcoxon;             

RUN;

Is there a way to do this?

Respected Advisor
Posts: 4,606

Re: Monte Carlo p-value for Wilcoxon test (NPAR1WAY)

Look for variable nValue1 in ODS output table WilcoxonTest, it contains the numerical p-value of the test. - PG

PG
Valued Guide
Valued Guide
Posts: 679

Re: Monte Carlo p-value for Wilcoxon test (NPAR1WAY)

SAS procedures have built in formats for the constants and variables that are printed. These carry over into the ods output files. But you can override these in PROC PRINT. For instance, if you saved an ods output file called test, and the p value was called p, then use:

proc print data=test;

format p 15.12;

run;

This gives you p to 12 decimal places (as an example). You can experiment with many other formats. Or to limit output just to p:

proc print data=test;

format p 15.12;

var p;

run;

Ask a Question
Discussion stats
  • 2 replies
  • 206 views
  • 0 likes
  • 3 in conversation