BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
csetzkorn
Lapis Lazuli | Level 10

I am using this code:

 

proc sort data= SomeData;
	by SomeGroup;
run;

proc corr data=SomeData nosimple pearson spearman outp=Temp;
	var x y;
	by SomeGroup;
run;

Is there a way to get the p values into the output dataset Temp as well? I get correlations for values, which are definitely not correlated. So maybe a p value threshold could help ...

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

As Reeza says, use ODS OUTPUT to save any statistic.  See http://support.sas.com/kb/22/848.html

Since you have BY groups, use ODS EXCLUDE to suppress the output to the screen:

 

ods exclude all;
proc corr data=SomeData;
ods output PearsonCorr=P;
	var x y;
	by SomeGroup;
run;
ods exclude none;

proc print data=P; run;

 

View solution in original post

4 REPLIES 4
Reeza
Super User

Aren’t P-Values in the output?

If so, use the ODS table instead, 

 

ods output pearsonCorr=want;

csetzkorn
Lapis Lazuli | Level 10
Thanks please adopt my original code as I do not understand. I also have the suspicion the my sas version does not produce p values.
Reeza
Super User

What version of SAS are you using?

 

You add that single line of code into your proc corr procedure, exactly as is. Then a data set is created called WANT, check your log.

 

If this doesn't work, please post your log and the exact code submitted.

Rick_SAS
SAS Super FREQ

As Reeza says, use ODS OUTPUT to save any statistic.  See http://support.sas.com/kb/22/848.html

Since you have BY groups, use ODS EXCLUDE to suppress the output to the screen:

 

ods exclude all;
proc corr data=SomeData;
ods output PearsonCorr=P;
	var x y;
	by SomeGroup;
run;
ods exclude none;

proc print data=P; run;

 

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 4 replies
  • 12722 views
  • 2 likes
  • 3 in conversation