Hello. I'm really new to SAS Studio programming and I have a question about my code. I have a dataset consisting of numbers regarding different products. I have in total 31 products with different values of the numbers stated in [box] (c1, D, cap1) etc. The thing is that I want to loop the minimalization object function Z for all 31 products so that they don't affect each other's values of the variable Q and Z. Which it seems like they do now since I'm not doing a loop for one product at the time. But I just can't figure out how I'm going to do it. proc import out=indata
DATAFILE='/home/phjesper0/Master/Minresultater1.xlsx'
DBMS=XLSX replace;
GETNAMES=YES;
/*USEDATE=YES;*/
title 'Vanlige tall';
proc print data=indata;
run;
Proc optmodel;
set <str> box;
var Q{box} >=0;
number c1{box};
number D{box};
number cap1{box};
number r1{box};
number r2{box};
number o1{box};
number f{box};
number o2{box};
number c2{box};
number p1{box};
number p2{box};
number cap2{box};
number life{box};
number w{box};
read data indata into box=[type] c1 D cap1 r1 r2 o1 f o2 c2 p1 p2 cap2 life w;
print c1 D cap1 r1 r2 o1 f o2 c2 p1 p2 cap2 life w;
minimize Z = sum {i in box} (((Q[i]/2)*((c1[i]*r1[i])+(c2[i]*r2[i]*f[i])))
+(D[i]/Q[i])*(((o1[i]*p1[i]) + (o2[i]*p2[i]*f[i]))*300 + (w[i]*c1[i])));
con MinShelfLife{i in box}:(life[i]-((360)/(D[i]/Q[i]))) >= 120;
con MaxShiftSize1{i in box}: Q[i]/cap1[i] <= 2;
con MaxShiftSize2{i in box}: Q[i]/(f[i]*cap2[i]) <= 2;
con MinBatch{i in box}: Q[i] >= 0;
solve;
print Z Q;
quit; Thanks!
... View more