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

Last week I found a post here on how to change the format of the p-values output by proc corr (via its template). I wonder whether it is possible to change the formats of ALL the p-values output by ALL SAS procedures, so that they are all the same, something like best9. for example?

(SASUniversityEdition, version 9.4)

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
Opps. You need the variable name firstly. For the following example . the variable name are pweight,pheight :



ods select none;
ods output PearsonCorr=corr;
proc corr data=sashelp.class;
var weight height;
run;
ods select all;
proc print data=corr noobs;
format pweight pheight pvalue.;
run;



View solution in original post

8 REPLIES 8
Ksharp
Super User
There is already a format PVALUE. you can use :

data _null_;
p=.00003;
put p= pvalue.;
p=.3;
put p= pvalue.;
run;




If you want output like SPSS : * ** *** 
Make a format for it :

proc format;
value fmt
 low-0.05='***'
 0.05<-0.1='**'
 0.1<-high='*';
run;
data _null_;
p=.00003;
put p= fmt.;
p=.3;
put p= fmt.;
run;

normanbg
Obsidian | Level 7

Dear Ksharp,

    Thank you for your reply; I was not aware of the pvalue. format. But how do I modify it from its current definition (any p-value < 1E-4 becomes <.0001) to something else, best9. for instance?

    Can I apply your second example ('like SPSS') to output produced by a procedure like proc corr?

 

Norman

ballardw
Super User

PVALUE is a SAS supplied format and you cannot modify it or create your own format with the same name in an attempt to override it. (I tried to confirm my suspicion).

 

Any procedure that you can create an output data set can have the the results printed or displayed using another report procedure like Proc Report or Proc Tabulate and associate the desired format with the value displayed.

 

 

normanbg
Obsidian | Level 7

Dear Ballardw,

    Thank you for your reply.

    I followed your suggestion with proc corr and proc report. Proc report does not reproduce the p-values of proc corr in its listing, only MEANS, STD, N, and CORR, no p-values at all; adding a format statement affects the output of the original variables only.

    Have I missed something?

 

Norman

Ksharp
Super User
Just apply the PVALUE. or the format I created above to proc corr .

proc corr.........
.........
format pvalue pvalue.;
OR
format pvalue best9.;


normanbg
Obsidian | Level 7

Dear Ksharp,

    Thank you for your reply and your continuing willingness to help.

    I tried yor suggestion and received the following:  "WARNING: Variable PVALUE not found in data set WORK.NORMAN.". The inability to modify the built-in format PVALUE has also been reported by ballardw (Super User) in his post above.

Ksharp
Super User
Opps. You need the variable name firstly. For the following example . the variable name are pweight,pheight :



ods select none;
ods output PearsonCorr=corr;
proc corr data=sashelp.class;
var weight height;
run;
ods select all;
proc print data=corr noobs;
format pweight pheight pvalue.;
run;



normanbg
Obsidian | Level 7

Dear Ksharp,

    BINGO! That did it. Thank you. Thank you very much.

 

Norman

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 8 replies
  • 3452 views
  • 0 likes
  • 3 in conversation