Hi user group,
If possible I would like to condense and improve my code by not having to repeat the same calculation x times, and I wonder if anyone have any tips on how to do this. I need to assign values (LandRisk) based on a projects fractional cost of a defined subgroup (pulled from database and not static). Thera are many groups but below I have given an example of two subgroup. What I would love to do is loop over a counter and just have to reference the calculation once but I am not able to get it to work. Any help is appreciated.
Thanks,
Tina
Set
benset1 (restorproj) /pr1150,pr1193/
benset2 (restorproj) /pr1191,pr1165,pr1112/
;
TotalCost=sum(benset1, SegmentCost(benset1));
loop(benset1,
LandRisk(benset1,uncertscen,restorregion,timeper)=LandRisk2(benset1,uncertscen,restorregion,timeper)*SegmentCost(benset1)/TotalCost;
);
TotalCost=sum(benset2, SegmentCost(benset2));
loop(benset2,
LandRisk(benset2,uncertscen,restorregion,timeper)=LandRisk2(benset2,uncertscen,restorregion,timeper)*SegmentCost(benset2)/TotalCost;
);
\
Wish I could do:
Set
benset1 (restorproj) /pr1150,pr1193/
benset2 (restorproj) /pr1191,pr1165/
iteration /1*50/
;
Loop(iteration,
TotalCost=sum(benset||iteration, SegmentCost(benset||iteration));
loop(benset||iteration,
LandRisk(benset||iteration,uncertscen,restorregion,timeper)=LandRisk2(benset||iteration,uncertscen,restorregion,timeper)*SegmentCost(benset||iteration)/TotalCost;
);
);
\
This email message is for the sole use of the intended recipient(s) and
may contain confidential information. Any unauthorized review, use,
disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and destroy all copies
of the original message.
–
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.