BookmarkSubscribeRSS Feed
MSALKAR
Calcite | Level 5

Hello, I keep getting these two error messages when I run my simulation. I cannot figure out where the error is. I am just posting some part of my code where I feel there may be an error. I know the data looks long but it is pretty much just same line with different numbers. So please go through. If required I will post the complete code. Thank you.

 

ERROR: (execution) Matrix has not been set to a value.

ERROR: No numeric variables in the dataset

 

data monika.combined;
set monika.combined;
%let newvars= &group1 &group2 &group3 &group4 &group5 &group6;
array newcoefsa (&k) &group1 &group2 &group3 &group4 &group5 &group6;

array x0a(&k) &wgroup1 &wgroup2 &wgroup3 &wgroup4 &wgroup5 &wgroup6;
array x1a(&k) &mgroup1 &wgroup2 &wgroup3 &wgroup4 &wgroup5 &wgroup6;
array x2a(&k) &mgroup1 &mgroup2 &wgroup3 &wgroup4 &wgroup5 &wgroup6;
array x3a(&k) &mgroup1 &mgroup2 &mgroup3 &wgroup4 &wgroup5 &wgroup6;
array x4a(&k) &mgroup1 &mgroup2 &mgroup3 &mgroup4 &wgroup5 &wgroup6;
array x5a(&k) &mgroup1 &mgroup2 &mgroup3 &mgroup4 &mgroup5 &wgroup6;
array x6a(&k) &mgroup1 &mgroup2 &mgroup3 &mgroup4 &mgroup5 &mgroup6;

 

xb0=intercept;
xb1=intercept;
xb2=intercept;
xb3=intercept;
xb4=intercept;
xb5=intercept;
xb6=intercept;

* perform white to minority variable distribution switches;
do i=1 to &k;
xb0=xb0+x0a(i)*newcoefsa(i);
xb1=xb1+x1a(i)*newcoefsa(i);
xb2=xb2+x2a(i)*newcoefsa(i);
xb3=xb3+x3a(i)*newcoefsa(i);
xb4=xb4+x4a(i)*newcoefsa(i);
xb5=xb5+x5a(i)*newcoefsa(i);
xb6=xb6+x6a(i)*newcoefsa(i);
end;

pred0=exp(xb0)/(1+exp(xb0));
pred1=exp(xb1)/(1+exp(xb1));
pred2=exp(xb2)/(1+exp(xb2));
pred3=exp(xb3)/(1+exp(xb3));
pred4=exp(xb4)/(1+exp(xb4));
pred5=exp(xb5)/(1+exp(xb5));
pred6=exp(xb6)/(1+exp(xb6));


fhat0=pred0*(1-pred0);
fhat1=pred1*(1-pred1);
fhat2=pred2*(1-pred2);
fhat3=pred3*(1-pred3);
fhat4=pred4*(1-pred4);
fhat5=pred5*(1-pred5);
fhat6=pred6*(1-pred6);

dc1db0=fhat0*one-fhat1*one;
dc2db0=fhat1*one-fhat2*one;
dc3db0=fhat2*one-fhat3*one;
dc4db0=fhat3*one-fhat4*one;
dc5db0=fhat4*one-fhat5*one;
dc6db0=fhat5*one-fhat6*one;


array dc1dba(&k) dc1db1-dc1db&k;
array dc2dba(&k) dc2db1-dc2db&k;
array dc3dba(&k) dc3db1-dc3db&k;
array dc4dba(&k) dc4db1-dc4db&k;
array dc5dba(&k) dc5db1-dc5db&k;
array dc6dba(&k) dc6db1-dc6db&k;

* create other variable components to derivatives;
do i=1 to &k;
dc1dba(i)=fhat0*x0a(i)-fhat1*x1a(i);
dc2dba(i)=fhat1*x1a(i)-fhat2*x2a(i);
dc3dba(i)=fhat2*x2a(i)-fhat3*x3a(i);
dc4dba(i)=fhat3*x3a(i)-fhat4*x4a(i);
dc5dba(i)=fhat4*x4a(i)-fhat5*x5a(i);
dc6dba(i)=fhat5*x5a(i)-fhat6*x6a(i);
end;


proc logistic data=monika.regdata outest=monika.orgcoefs2 covout descending noprint;
model y=&gendervars &newvars / link=logit;
weight wt / normalize;

data monika.covar (drop=&gendervars _link_ _type_ _status_ _name_ _lnlike_);
set monika.orgcoefs2;
* delete coefs and rows associated with racevars;
if _n_=1 or (3<=_n_<=(&r+2)) then delete;

proc means data=monika.combined noprint;
var yw ym pred0-pred6
dc1db0 dc1db1-dc1db&k
dc2db0 dc2db1-dc2db&k
dc3db0 dc3db1-dc3db&k
dc4db0 dc4db1-dc4db&k
dc5db0 dc5db1-dc5db&k
dc6db0 dc6db1-dc6db&k
ordgroup1-ordgroup6;
output out=means1 mean=;


data monika.cont1 (keep=dc1db0 dc1db1-dc1db&k)
monika.cont2 (keep=dc2db0 dc2db1-dc2db&k)
monika.cont3 (keep=dc3db0 dc3db1-dc3db&k)
monika.cont4 (keep=dc4db0 dc4db1-dc4db&k)
monika.cont5 (keep=dc5db0 dc5db1-dc5db&k)
monika.cont6 (keep=dc6db0 dc6db1-dc6db&k);
set monika.means1;

proc iml;
use monika.covar;
read all var _num_ into V;
use monika.cont1;
read all var _num_ into DC1DB;
use monika.cont2;
read all var _num_ into DC2DB;
use monika.cont3;
read all var _num_ into DC3DB;
use monika.cont4;
read all var _num_ into DC4DB;
use monika.cont5;
read all var _num_ into DC5DB;
use monika.cont6;
read all var _num_ into DC6DB;

VAR1=DC1DB*V*t(DC1DB);
VAR2=DC2DB*V*t(DC2DB);
VAR3=DC3DB*V*t(DC3DB);
VAR4=DC4DB*V*t(DC4DB);
VAR5=DC5DB*V*t(DC5DB);
VAR6=DC6DB*V*t(DC6DB);


create monika.vardata var {var1 var2 var3 var4 var5 var6};
append;

data monika.means1 (keep=yw ym pred0-pred6 var1-var6 cont1-cont6 ordgroup1-ordgroup6);
merge monika.means1 monika.vardata;
cont1=pred0-pred1;
cont2=pred1-pred2;
cont3=pred2-pred3;
cont4=pred3-pred4;
cont5=pred4-pred5;
cont6=pred5-pred6;


data monika.means1 (keep = yw ym contg1-contg6 vargroup1-vargroup6);
set monika.means1;
array ordgroupa{6} ordgroup1-ordgroup6;
array contgroupa{6} contg1-contg6;
array vargroupa{6} vargroup1-vargroup6;
array conta{6} cont1-cont6;
array vara{6} var1-var6;
do j = 1 to 6;
do i = 1 to 6;
if ordgroupa[j] = i then do;
contgroupa[j] = conta[i];
vargroupa[j] = vara[i];
end;
end;
end;


data monika.means2;
set monika.means2 monika.means1;
run;
%end;

%mend;

run;
options nonotes;
%simulate;
run;

proc means data=monika.means2;
title2 'Mean Values of Contribution Estimates from Simulations';
var yw ym contg1-contg6 vargroup1-vargroup6;
output out=monika.meandecomp mean=;

data monika.meandecomp;
merge monika.meandecomp monika.ywdata monika.ymdata;
gap=ymfull-ywfull;
perc1=contg1/gap;
perc2=contg2/gap;
perc3=contg3/gap;
perc4=contg4/gap;
perc5=contg5/gap;
perc6=contg6/gap;
se1=sqrt(vargroup1);
se2=sqrt(vargroup2);
se3=sqrt(vargroup3);
se4=sqrt(vargroup4);
se5=sqrt(vargroup5);
se6=sqrt(vargroup6);
label contg1=&labelgroup1;
label contg2=&labelgroup2;
label contg3=&labelgroup3;
label contg4=&labelgroup4;
label contg5=&labelgroup5;
label contg6=&labelgroup6;


options label;

proc means data=monika.meandecomp mean;
title2 'Final Output for Table - Means Values for Contribution Estimates';
var ywfull ymfull gap
contg1 se1 perc1 contg2 se2 perc2 contg3 se3 perc3 contg4 se4 perc4
contg5 se5 perc5 contg6 se6 perc6;
run;

 

3 REPLIES 3
Rick_SAS
SAS Super FREQ

Next time please post the log.

 

It looks like one of the data set does not have any numerical variables. The error is probably one of these line:

 

use monika.covar;
read all var _num_ into V;
use monika.cont1;
read all var _num_ into DC1DB;
use monika.cont2;
read all var _num_ into DC2DB;
use monika.cont3;
read all var _num_ into DC3DB;
use monika.cont4;
read all var _num_ into DC4DB;
use monika.cont5;
read all var _num_ into DC5DB;
use monika.cont6;
read all var _num_ into DC6DB;

MSALKAR
Calcite | Level 5

This is the error I can see in my log. I am still not understanding where the error is. Let me know what else you need inroder to help me fix this problem. Thank you

 

 

 

ERROR: (execution) Matrix has not been set to a value.

operation : * at line 17659 column 121
operands : DC4DB, V

DC4DB 0 row 0 col (numeric)

V 15 rows 15 cols (numeric)

statement : ASSIGN at line 17659 column 111

MSALKAR
Calcite | Level 5
I see that there is a problem with these lines

use monika.covar;
read all var _num_ into V;
use monika.cont1;
read all var _num_ into DC1DB;
use monika.cont2;
read all var _num_ into DC2DB;
use monika.cont3;
read all var _num_ into DC3DB;
use monika.cont4;
read all var _num_ into DC4DB;
use monika.cont5;
read all var _num_ into DC5DB;
use monika.cont6;
read all var _num_ into DC6DB;

My log states that all of the above datasets do not have numeric variables.
Is there a way to code the above same code for categorical variables?
Please let me know.

##- Please type your reply above this line. Simple formatting, no
attachments. -##

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1761 views
  • 0 likes
  • 2 in conversation