PROC IML has a CORR function that you can use for Pearson or Spearman correlations. See SAS/IML(R) 12.3 User's Guide However, if you want to write a module that reproduces the built-in computations, use the 'MyCorr' function in the article Computing covariance and correlation matrices - The DO Loop
... View more