First, big thanks for you help. Then, I used code as follows. data inputs;
input input $8.;
datalines;
staff
showroom
;
data outputs;
input output $10.;
datalines;
beta_sales
profit
;
data garage_data;
input garage_name $ year region $ staff showroom alpha_sales beta_sales profit;
datalines;
Winchester 2020 A 7 8 10 12 8.5 4 2 0.6 1.5
Andover 2020 A 6 6 20 30 9 4.5 2.3 0.7 1.6
Basingstoke 2020 B 2 3 40 40 2 1.5 0.8 0.25 0.5
Poole 2020 B 14 9 20 25 10 6 2.6 0.86 1.9
Winchester 2021 A 10 9 10 10 11 5 2.4 1 2
Andover 2021 A 24 15 15 13 25 19 8 2.6 4.5
Basingstoke 2021 B 6 7 50 40 8.5 3 2.5 0.9 1.6
Poole 2021 B 8 7.5 5 8 9 4 2.1 0.85 2
;
proc cas noqueue;
source pgm;
put _BY_LINE_;
set <str> INPUTS;
read data inputs nogroupby into INPUTS=[input];
set <str> OUTPUTS;
read data outputs nogroupby into OUTPUTS=[output];
set <num> GARAGES;
str garage_name {GARAGES};
num input {INPUTS, GARAGES};
num output {OUTPUTS, GARAGES};
read data garage_data into GARAGES=[garage] garage_name
{i in INPUTS} <input[i,garage]=col(i)>
{i in OUTPUTS} <output[i,garage]=col(i)>;
num k;
num efficiency_number {GARAGES};
num weight_sol {GARAGES, GARAGES};
var Weight {GARAGES} >= 0;
var Inefficiency >= 0;
max Objective = Inefficiency;
con Input_con {i in INPUTS}:
sum {j in GARAGES} input[i,j] * Weight[j] <= input[i,k];
con Output_con {i in OUTPUTS}:
sum {j in GARAGES} output[i,j] * Weight[j] >= output[i,k] * Inefficiency;
do k = GARAGES;
solve;
efficiency_number[k] = 1 / Inefficiency.sol;
for {j in GARAGES}
weight_sol[k,j] = (if Weight[j].sol > 1e-6 then Weight[j].sol else .);
end;
print garage_name efficiency_number;
create data efficiency_data from [garage] garage_name efficiency_number;
endsource;
loadActionSet 'optimization';
action optimization.runOptmodel / code=pgm groupBy={'year','region'};
run;
quit; But I received the errors from log, like these: ERROR: There is no server connection to execute the action 'loadactionset'. ERROR: Execution halted 1) How do I solve the problem about server connection? 2) If I used the code as you mentioned, could it output the result according to year and region separately? Thanks.
... View more