"What I should have asked is once I get Y values under different scenarios of changes, I'll calculate the proportion or share - Y1/sum of Y1-10, Y2/sum of Y, etc.) and get mean and SD of the share."
Post your output and formula would better to clarify your question.
This code is almost the same as above .
data have; input
ID A B C D E N1 N2 N3 N4 N5 N6 D1 D2 D3 D4 D5 D6;
datalines;
1 100 10 0.5 15 10 35 8 6 4 2 1 39 8 5 5 1 2
2 200 11 0.3 25 15 35 8 6 4 2 2 42 7 7 4 2 3
3 300 20 0.4 15 14 40 8 6 4 2 3 53 9 6 5 3 2
4 150 19 0.1 5 19 27 8 6 4 2 4 35 4 9 7 4 4
5 400 40 0.5 35 20 50 8 6 4 2 6 79 17 4 9 1 5
6 900 50 0.4 55 15 70 8 6 4 2 9 85 5 9 4 2 11
7 600 30 -0.5 20 29 60 8 6 4 2 2 62 16 7 5 4 10
8 500 30 0.2 25 17 50 8 6 4 2 3 60 4 9 8 2 5
9 400 30 0.4 19 16 44 8 6 4 2 1 49 8 4 4 5 9
10 700 45 0.3 39 14 34 8 6 4 2 1 38 3 2 5 4 12
;
run;
proc iml;
use have(keep= A B C D E);
read all var _num_ into have[c=vnames];
close;
use have(keep= N1-N6);
read all var _num_ into N;
close;
use have(keep= D1-D6);
read all var _num_ into D;
close;
Parm_N={1 -1 -1 -1 -1 -1};
Parm_D={1 -1 -1 -1 -1 -1};
magnitude={-1.05 1.05};
Y=j(nrow(have),1,.);
id=j(ncol(magnitude)#ncol(have),1,blankstr(40));
mean_std=j(ncol(magnitude)#ncol(have),2,.);
mattrib mean_std c={mean std};
idx=0;
do i=1 to ncol(magnitude);
do j=1 to ncol(vnames);
Parm_have=j(1,ncol(have),1);
Parm_have[j]=magnitude[i];
do k=1 to nrow(have);
temp=have[k,];
wgt=(N[k,]*Parm_N`)/(D[k,]*Parm_D`);
wgt=choose(wgt>1,1,wgt);
Y[k]=(Parm_have[1]#temp[1]#
Parm_have[2]#temp[2]#
(Parm_have[3]#temp[3]+1)
-Parm_have[4]#temp[4]
-Parm_have[5]#temp[5])#wgt;
end;
idx=idx+1;
id[idx]=char(magnitude[i])+'*'+vnames[j];
mean_std[idx,1]=mean(Y/sum(Y));
mean_std[idx,2]=std(Y/sum(Y));
end;
end;
print id mean_std[l=''];
quit;
... View more