Hi all,
I tried to run a ols using proc fcmp. I get a missing SSCP matrix. Hence the program doesnot run.
I appreicate all the help.
Regards,
Amit
code:
data temp;
set sashelp.cars;
keep MPG_City Horsepower Cylinders Weight Length;
run;
proc fcmp;
/* Allocate spaces for matrices */
array input[428, 5] / nosym;
array y[428] / nosym;
array x[428, 4] / nosym;
array xtrans[4, 428] / nosym;
array sscp[4, 4] / nosym;
array sscpinv[4, 4] / nosym;
array beta[4] / nosym;
array xtrans_y[4, 1] / nosym;
/* Input simulation dataset */
rc1 = read_array("temp", input, "MPG_City", "Horsepower", "Cylinders", "Weight", "Length");
rc2 = read_array("temp", y, "MPG_City");
rc3 = read_array("temp", x, "Horsepower", "Cylinders", "Weight", "Length");
/* Calculate OLS regression coefficients */
call transpose(x, xtrans);
call mult(xtrans, x, sscp);
call inv(sscp, sscpinv);
call mult(xtrans, y, xtrans_y);
call mult(sscpinv, xtrans_y, beta);
/* Output resulting matrix as dataset */
rc44 = write_array("sscp1", sscp);
rc46 = write_array("xtrans_y1", xtrans_y);
rc4 = write_array("result", beta);
if rc1 + rc2 + rc3 + rc4 > 0 then put 'ERROR: I/O error';
else put 'NOTE: I/O was successful';
quit;