Hello everyone,
I wrote a CGE code in which I imported the SAM data from Excel spreadsheet. Look at the code below:
Set
u 'SAM entry' / agri, extra, alim ,indu, utilities ,cons ,trade,
trans, serv,public,TAXDOM, TAXIMP, TAXEXP, trav_q, trav_nq,cap ,terre, r_nat,
HH ,GOV, FNF, Bcen, Bcom, rdm, HH2 ,GOV2, FNF2, Bcen2, Bcom2,rdm2, Mfi,
Dep, CDom ,Cext, Res, Ref, AV, Resext, AExt, VK/
i(u) 'goods' / agri, extra, alim,indu, utilities, cons, trade, trans, serv, public /
h(u) 'factor' / trav_q,trav_nq,cap, terre, r_nat /
h_mob(h) 'mobile factor' / trav_q,trav_nq /
h_imm(h) 'immobile factor' / cap, terre, r_nat /
af(u) 'actifs financiers' / Mfi,Dep,CDom ,Cext,Res,Ref,AV,Resext,AExt,VK /
Agr(u) 'agents courants' /HH ,GOV, FNF, Bcen, Bcom, rdm /
Ag(u) 'agents capital' /HH2 ,GOV2, FNF2, Bcen, Bcom2, rdm2 /
afd(af) 'actifs domestiques' /Mfi, Dep, CDom , Res, Ref, AV, VK/
afe(af) 'actifs etrangers' / Cext, Resext, AExt/
t 'time' / 2015 /;
Alias (u,v), (i,j), (h,k), (af,afc),(ag,agc);
*for SAM data
Parameter
SAM(u,v) 'social accounting matrix'
SAMGAP(u) 'gaps between row sums and column sums';
*data importation
$call gdxxrw.exe i=mat2.xlsx o=tran.gdx par=sam rng=CMR!b3:ap43 rdim=1 cdim=1
$gdxin tran.gdx
$load sam
$gdxin
SAMGAP(u) = sum(v, SAM(u,v) - SAM(v,u));
display sam, SAMGAP;
*Now, I declared the following parameter
parameter
Daf00(af, ag) ;
Daf00(af, ag) = SAM(af, ag);
Display Daf00;
*Actually, the set "af" has 10 elements and "ag" has 5 elements and all the entries (af, ag) are displayed in the SAM.
However, by displaying Daf00, I just count 7 components of "Af" and 5 components of "ag", which doesn't make any sense. I though the problem would rely on the set declaration but it doesn't seem the best way. Please look at the attachments for the entire code and help me to overcome this.
Best regards,
Rodrigue[attachment=1]BEAC 2.gms[/attachment]
Mat2.xlsx (115 KB)
BEAC 2.gms (45.4 KB)