Thinking more about your request, I realized that a non-macro solution is likely more efficient than a macro. Note that all the statistics needed for the calculation of the concordance correlation coefficients (CCCs) are contained in the output of PROC CORR, applied to the list of your about 40 variables. So, the CCCs can be computed in a DATA step going through the list of all ordered pairs of variables. This list, in turn, can be created from the PROC CORR output dataset by PROC TRANSPOSE.
Here is an example using the SAS-supplied dataset SASHELP.JUNKMAIL, from which I took an arbitrary list of 40 numeric variables just to demonstrate that the code works. The final dataset WANT contains comb(40,2)=780 observations, one for each ordered pair of variables.
/* Compute mean values and empirical (co)variances */
proc corr data=sashelp.junkmail cov outp=stats noprint /* vardef=n */;
var make--direct; /* This variable list contains 40 (numeric) variables. */
run;
/* Create a "long" dataset from the empirical covariance matrix, avoiding redundant values of the statistic (_s) */
proc transpose data=stats(rename=(_name_=_var1)) name=_var2 out=covlist(where=(_var1<=_var2) rename=(col1=_s));
where _type_='COV';
by _var1 notsorted;
run;
/* Create a "long" dataset containing the mean values from the PROC CORR output dataset */
proc transpose data=stats(drop=_name_) name=_var1 out=means(rename=(col1=_s));
where _type_='MEAN';
run;
/* Compute the concordance correlation coefficients (_rc) as in the code posted on Dec 7, 2019 */
data want(keep=_var1 _var2 _rc);
set covlist(where=(_var1<_var2));
if _n_=1 then do;
dcl hash _m(dataset:'means');
_m.definekey('_var1');
_m.definedata('_s');
_m.definedone();
dcl hash _v(dataset:'covlist(where=(_var1=_var2))');
_v.definekey('_var1');
_v.definedata('_s');
_v.definedone();
end;
_sxy=_s;
_sxx=ifn(_v.find(),.,_s);
_syy=ifn(_v.find(key:_var2),.,_s);
_mx =ifn(_m.find(),.,_s);
_my =ifn(_m.find(key:_var2),.,_s);
_rc=2*_sxy/(_sxx+_syy+(_mx-_my)**2);
run;
/* Optional: Sort the resulting dataset alphabetically */
proc sort data=want;
by _var1 _var2;
run;
By using the VARDEF option of the PROC CORR statement (commented out in the code above) you can easily switch between the slightly different implementations of the CCC obtained with VARDEF=DF (the default) and VARDEF=N, which are mentioned in the Wikipedia article Concordance correlation coefficient (at the end of the section headed "Definition").
... View more