I'm running a corr function in iml, e.g.,
proc iml;
use want_ret;
read all var _NUM_ into x[colname=permno];
close want_ret;
corr=corr(x);
print corr;
quit; run;
Because my data has some missing value I get an execution error - "Invalid argument or operand; contains missing value."
I found this page which seems to suggest that I should be able to compute it with missing values: http://support.sas.com/documentation/cdl/en/imlug/64248/HTML/default/viewer.htm#imlug_langref_sect05...
I thought the syntax would be corr(x,Pearson,pairwise); but that doesn't seem to work either. Any ideas? I'd like the correlation even though I'm missing just a few observations in the time series.
Thanks,
Rick
The CORR function supports missing values:
proc iml;
use sashelp.class;
read all var _NUM_ into X;
X[{1 7 19 32}]=.;
c = corr(x);
print c;
print (countmiss(X,"col"));
In fact, you can have all missing values and hte CORR function still doesn't return an error:
X = j(10,3,.);
c = corr(x);
print c;
This assumes that you are running SAS/IML 9.22 or later. Please copy/paste the EXACT contents of the SAS log.
By the way, if you use optional arguments, be sure to enclose them in quotes
corr(x,"Pearson","pairwise");
as specified in the doc.
I appear to be running sas 9.2. If I hit about sas it says SAS 9.2 TS Level 2M2, X64_VSPRO platform. Is that the issue?
thanks,
Rick
I think that TS2M3 is the stealth SAS/Stat upgrade to 9.22.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.