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

Using this:

 

ods exclude all;
proc corr data=SomeInputData;
ods output PearsonCorr=SomeOutputData;
	var SomeMeasure;
	by SomeCategory;
run;
ods exclude none;

Gives me the Pearson correlation including p values. Can I also obtain the Kendall rank, Spearman and Point-Biserial correlation using proc corr (or other procs)?

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

The answer is the same as last time you asked, but replace the word 'Pearson' by 'Spearman.'.

See https://communities.sas.com/t5/SAS-Procedures/add-p-values-to-output-dataset-of-proc-corr/m-p/430081

 

If I may suggest, it will be easier to ask and answer questions if you post code that uses one of the built-in SAS data sets in the SASHELP libref.  See also the SAS/STAT data sets.

 

My favorites in Sashelp are Class,Cars, Heart, and Iris.  You can use PROC CONTENTS to see the variables and PROC PRINT (OBS=5) to see a few records.For example, here is your solution using Cars:

 

proc sort data=sashelp.cars out=cars;
by origin;
run;

ods exclude all;
proc corr data=cars Spearman;
ods output SpearmanCorr=P;
	var mpg_city weight;
	by Origin;
run;
ods exclude none;

proc print data=P; run;

 

View solution in original post

5 REPLIES 5
Reeza
Super User

Somewhat, see the options on the PROC CORR statement in the documentation.

I don't know if Point-Biserial correlation is available. 

 

 

ballardw
Super User

Did you SAS install not come with ANY online help or documentation?

 

You can request Fisher Hoeffding Kendal Pearson Polychoric Polyserial and Spearman correlations with proc corr.

Rick_SAS
SAS Super FREQ

To follow-up on Ballardw's comment, all documentation is posted online. Here are some URLs that I have bookmarked for easy reference:

 

Most Base SAS Procedures: CONTENTS, COMPARE, MEANS, RANK,...

Base SAS Statistical Procedures: CORR, FREQ, and UNIVARIATE  <== relevant for current question

DATA Step Functions and Call Routines

SAS/STAT User's Guide

SAS/IML User's Guide

 

csetzkorn
Lapis Lazuli | Level 10

Hi all,

 

Thanks and apologies for not doing enough research. I wrote this on the mobile last night and did not have reliable Internet access.

 

I am currently using this code to obtain the Spearman correlation:

 

ods exclude all;
PROC CORR DATA=SomeInputData SPEARMAN out=SomeOutputData;
   var SomeMeasure;
	by SomeCategory;
RUN;
ods exclude none;

Is there a way to get p values similarly to the Pearson correlation code in my original question?

Rick_SAS
SAS Super FREQ

The answer is the same as last time you asked, but replace the word 'Pearson' by 'Spearman.'.

See https://communities.sas.com/t5/SAS-Procedures/add-p-values-to-output-dataset-of-proc-corr/m-p/430081

 

If I may suggest, it will be easier to ask and answer questions if you post code that uses one of the built-in SAS data sets in the SASHELP libref.  See also the SAS/STAT data sets.

 

My favorites in Sashelp are Class,Cars, Heart, and Iris.  You can use PROC CONTENTS to see the variables and PROC PRINT (OBS=5) to see a few records.For example, here is your solution using Cars:

 

proc sort data=sashelp.cars out=cars;
by origin;
run;

ods exclude all;
proc corr data=cars Spearman;
ods output SpearmanCorr=P;
	var mpg_city weight;
	by Origin;
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
  • 5 replies
  • 2356 views
  • 6 likes
  • 4 in conversation