New SAS User

Completely new to SAS or trying something new with SAS? Post here for help getting started.
BookmarkSubscribeRSS Feed
UnGiffted
Calcite | Level 5

Hi all,

 

I'm looking at values from the right and left side of the body and using PROC CORR to test for a correlation between the two sides. I have a zero-inflated data set (the zeroes are meaningful to me and thus cannot be removed), and while doing PROC CORR, I'm getting matrices back without estimates because the standard error is zero. Is there a way around this/how should this be reported?

 

I'm also getting scatter plots back with curved fit lines. Can I fix this somehow? Or is this just how it is because of my data? Examples of both are below, along with the code that is being used.

 

Thanks in advance. 

 

PROC CORR Data=coimbra_big PLOTS=SCATTER(NVAR=all);
VAR EXTLZ2CA EXTRZ2CA;
run;

 

 

The SAS System

The CORR Procedure
2 Variables:
EXTLZ1ER EXTRZ1ER

 

Simple StatisticsVariable N Mean Std Dev Sum Minimum Maximum
18100000
2050.014630.155873.0000002.00000

 

Pearson Correlation CoefficientsProb > |r| under H0: Rho=0Number of Observations 
EXTLZ1ER EXTRZ1EREXTLZ1EREXTRZ1ER
.
.
181
.
.
129
.
.
129
1.00000
 
205
 
2 REPLIES 2
ballardw
Super User

When a variable has no variability, such as all the values being exactly the same, which appears to be the case with one of your variables then the standard deviation is zero. Period. Notice that you summary shows that mean, max, and minimum are also all 0 for the first variable.

 

What happens in this case for correlation is that the constant variable has no correlation because there is no change when the other variable changes values.

 

I suggest investigating why that variable only has a value of zero will likely gain more information.

 

PGStats
Opal | Level 21

Report those correlations as missing: there is no way they can be estimated from your data.  The curved lines on the scatter graphs are prediction ellipses. To get rid of them, specify PLOTS=SCATTER(ELLIPSE=NONE) on the proc corr statement.

PG

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 825 views
  • 0 likes
  • 3 in conversation