BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Kirill_Voronov
Calcite | Level 5

Hello SAS community!

 

While reading  this paper (page 12), I came across an ambiguous output.

Judging by the code given in the paper (screenshot attached),

 

изображение.png

the output dataset wtestp should contain the following variables:

  • Name1
  • cValue1
  • nValue1

However, when trying to reproduce the output (at least in sas version 9.4), it turned out to be completely different (not in relation to the data presented, but in relation to the structure of the data set).

 

A reproducible example:

 

ods output WilcoxonTest = wtestp;
proc npar1way data = sashelp.class wilcoxon;
	class sex;
	var age;
run;

The wtestp output is not at all similar to that in paper. It doesn't contain any variables with such names, and none of the variables contains the values "P2_WALL" 2_WALL.

изображение.png

It is clear that the p-values are eventually obtained. But, this output doesn't allow them to be used in the macro as it was originally intended.

 

Is it possible that I am doing something wrong and there is an opportunity to get the desired result?

Thank in advance for any help!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

According to the documentation, PROC NPAR1WAY changed the format of score test tables in SAS/STAT 15.1 (SAS 9.4M6). The doc says "You can specify the TABLES=RESTORE option in the PROC NPAR1WAY statement to display these tables in factoid (label-value) format, which is their format in releases before SAS/STAT 15.1."

 

For your reproducible example:

ods output WilcoxonTest = wtestp;
proc npar1way data = sashelp.class wilcoxon tables=restore;
	class sex;
	var age;
run;

proc print data=wtestp; run;

View solution in original post

4 REPLIES 4
ballardw
Super User

Do not expect the same sorts of output when you remove BY variables from code.

 

This, which  uses a BY statement does have those variables.

proc sort data=sashelp.class
    out=work.class;
    by age;
run;
ods output WilcoxonTest = wtestp;
proc npar1way data = work.class wilcoxon;
   by age;
   class sex;
   var height;
run;

If you want to use code from someone else's macros your call and data have to match, in this case include a BY statement. Even a trivial variable:

data work.classjunk;
   set sashelp.class;
   bybob='1';
run;
ods output WilcoxonTest = wtestp;
proc npar1way data = work.classjunk wilcoxon;
   by bybob;
	class sex;
	var height;
run;

The target of that paper is to use BY group processing as way to avoid making multiple single procedure calls to get the output for multiple calls. So when you bypass the multiple calls, i.e. BY group processing, then the data is not in the expected form to use the reporting parts because it would not be needed.

Kirill_Voronov
Calcite | Level 5

ballardw

Thank you for replying, but I have already tested the option with BY statement.

Adding this setting does not affect the response dataset format.

For example, your first example gives the following result:

 

изображение.png

There are no variables named Name1, cValue1, nValue1... which i need to my own macro.

 

At the same time, the ODS output from PROC FREQ gives exactly what I want (but I want this for the PROC NPAR1WAY):

ods output FishersExact = ftestp;
proc freq data = sashelp.cars;
	tables  origin*drivetrain/exact;
run;

изображение.png

 

Thank you!

Rick_SAS
SAS Super FREQ

According to the documentation, PROC NPAR1WAY changed the format of score test tables in SAS/STAT 15.1 (SAS 9.4M6). The doc says "You can specify the TABLES=RESTORE option in the PROC NPAR1WAY statement to display these tables in factoid (label-value) format, which is their format in releases before SAS/STAT 15.1."

 

For your reproducible example:

ods output WilcoxonTest = wtestp;
proc npar1way data = sashelp.class wilcoxon tables=restore;
	class sex;
	var age;
run;

proc print data=wtestp; run;
Kirill_Voronov
Calcite | Level 5
Thank you very much. It helped a lot!

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is ANOVA?

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.

Discussion stats
  • 4 replies
  • 3058 views
  • 7 likes
  • 3 in conversation