I have hourly measurements from different parts of the city for one complete year (VAR1 - VAR5). I am trying to do both regression and correlation between the measurements between different parts of the city. For some reason, when I use a "BY" group variable, in this case month, it returns the same correlation coefficients for each month. Obs month hour var1 var2 var3 var4 var5123456 1 1 0.60846 0.53326 0.28989 0.38048 0.38778 1 2 0.58190 0.53971 0.27384 0.31625 0.33136 1 3 0.57963 0.54900 0.27453 0.29811 0.32408 2 1 0.59448 0.55839 0.28766 0.31432 0.35230 2 2 0.34333 0.58383 0.48293 0.12345 0.12345 2 3 0.12345 0.12345 0.12345 0.12345 0.12345 proc corr data = HAVE outp = corr_out noprint;
var var1 var2 var3 var4 var5;
by month;
run;
proc reg data = HAVE outest = reg_out noprint;
BY month;
model var1 = var2 var3 var4 var5;
run; For the correlation matrix, I get the same correlation coefficients between variables, regardless of month. For regression, I get the same RMSE for all months, but with different intercepts for each month. I am looking for the correlation coefficients between variables separately by month and then the same for regression. Examples below: Obs month _TYPE_ _NAME_ var1 var2 var3 var4 var5123451314151617 1 CORR var1 1.00000 0.90649 0.77150 0.94332 0.96095 1 CORR var2 0.90649 1.00000 0.49266 0.96825 0.83921 1 CORR var3 0.77150 0.49266 1.00000 0.67258 0.86697 1 CORR var4 0.94332 0.96825 0.67258 1.00000 0.93250 1 CORR var5 0.96095 0.83921 0.86697 0.93250 1.00000 2 CORR var1 1.00000 0.90649 0.77150 0.94332 0.96095 2 CORR var2 0.90649 1.00000 0.49266 0.96825 0.83921 2 CORR var3 0.77150 0.49266 1.00000 0.67258 0.86697 2 CORR var4 0.94332 0.96825 0.67258 1.00000 0.93250 2 CORR var5 0.96095 0.83921 0.86697 0.93250 1.00000 Obs month _MODEL_ _TYPE_ _DEPVAR_ _RMSE_ Intercept var2 var3 var4 var5 var112345 1 MODEL1 PARMS var1 .002905584 -0.043973 1.16554 0.28112 -0.93889 0.32547 -1 2 MODEL1 PARMS var1 .002905584 -0.080612 1.16554 0.28112 -0.93889 0.32547 -1 3 MODEL1 PARMS var1 .002905584 -0.061661 1.16554 0.28112 -0.93889 0.32547 -1 4 MODEL1 PARMS var1 .002905584 -0.067980 1.16554 0.28112 -0.93889 0.32547 -1 5 MODEL1 PARMS var1 .002905584 -0.083593 1.16554 0.28112 -0.93889 0.32547 -1
... View more