I run into this error when I use the codegen technique, for 1 groupby variables it works, but if I add a second one it fails.
Without the code gen option it still works, but I need the code option for scoring purpose.
What works:
FILENAME SCORE TEMP;
proc cas;
datapreprocess.binning result=r /
table={name="AUTO_SEGURO_LEARNER_V11", caslib="dna", groupby={'combustible'},
groupByMode="REDISTRIBUTE",
where="((orig='data_in' and last_event) or orig='toscore') and (0 < _KMJEREAL_Max < 200000)"}
inputs={"PotenCV", "EmisioCO2"}
code={comment=true, tabForm=true}
method="quantile" nBinsArray={3, 3}
;
run;
print r;
run;
saveresult r['CodeGen'] file=score;
run;
proc cas;
code = readfile("score");
dscode =
"data DNA.ac_test;
set DNA.AUTO_SEGURO_LEARNER_V11;"
|| code ||
"
keep bin: PotenCV EmisioCO2;
run;";
run;
dataStep.runCode / code = dscode;
run;
What does not work although I only add one more groupby variable:
FILENAME SCORE TEMP;
proc cas;
datapreprocess.binning result=r /
table={name="AUTO_SEGURO_LEARNER_V11", caslib="dna", groupby={'from_brand', 'combustible'},
groupByMode="REDISTRIBUTE",
where="((orig='data_in' and last_event) or orig='toscore') and (0 < _KMJEREAL_Max < 200000)"}
inputs={"PotenCV", "EmisioCO2"}
code={comment=true, tabForm=true}
method="quantile" nBinsArray={3, 3}
;
run;
print r;
run;
saveresult r['CodeGen'] file=score;
run;
proc cas;
code = readfile("score");
dscode =
"data DNA.ac_test;
set DNA.AUTO_SEGURO_LEARNER_V11;"
|| code ||
"
keep bin: PotenCV EmisioCO2 from_brand combustible;
run;";
run;
dataStep.runCode / code = dscode;
run;
The error appears: ERROR: Insufficient resources to perform the analytic operation.
If I skip the code block, it still works.
proc cas;
datapreprocess.binning result=r /
table={name="AUTO_SEGURO_LEARNER_V11", caslib="dna", groupby={'from_brand', 'combustible'},
groupByMode="REDISTRIBUTE",
where="((orig='data_in' and last_event) or orig='toscore') and (0 < _KMJEREAL_Max < 200000)"}
inputs={"PotenCV", "EmisioCO2"}
/* code={comment=true, tabForm=true} */
method="quantile" nBinsArray={3, 3}
;
run;
print r;
run;
If the scoring is limited to just a few observations does it complete? If so, at least we know the generated code should be sound for the two groupby case and some resource limit is indeed most likely being hit.
"data DNA.ac_test;
set DNA.AUTO_SEGURO_LEARNER_V11;
if _N_ <= 10;"
|| code ||
"
You could try reducing the resources used during scoring by only reading in the needed variables and compressing the output table.
"data DNA.ac_test (compress=yes);
set DNA.AUTO_SEGURO_LEARNER_V11 (keep=PotenCV EmisioCO2 from_brand combustible);"
|| code ||
"
Also, if the scoring code is not being used elsewhere, you could let the binning action do the scoring. It may be just doing the same thing behind-the-scenes and not make any difference, but it's worth a try.
proc cas;
datapreprocess.binning result=r /
table={name="AUTO_SEGURO_LEARNER_V11", caslib="dna", groupby={'from_brand', 'combustible'},
groupByMode="REDISTRIBUTE",
where="((orig='data_in' and last_event) or orig='toscore') and (0 < _KMJEREAL_Max < 200000)"}
inputs={"PotenCV", "EmisioCO2"}
/* code={comment=true, tabForm=true} */
method="quantile" nBinsArray={3, 3}
includeInputVars=TRUE
casout={name="ac_test", caslib="DNA", replace=true /*, compress=true, replication=0*/}
;
run;
print r;
run;
Thanks for your reply.
The error happens while trying to generate the code file.
ERROR: Insufficient resources to perform the analytic operation.
In other circunstances (applied to a different table with other group by variables) the code works fine.
The faulty code even works when I leave only one group by variable.
Scoring the current table does not suffice. I need the scoring code. I could generate the score code in a caslib table, but then I don't succeed in referencing the caslib table with when I use the score code.
So, this one works, but how can I use casuser.scory table for scoring purpose?
FILENAME SCORE TEMP;
cas mySession sessopts=(caslib="casuser");
proc cas;
datapreprocess.binning result=r /
table={name="AUTO_SEGURO_LEARNER_V11", caslib="dna", groupby={'from_brand', 'combustible'},
groupByMode="REDISTRIBUTE",
where="((orig='data_in' and last_event) or orig='toscore') and (0 < _KMJEREAL_Max < 200000)"}
inputs={"PotenCV", "EmisioCO2"}
code={comment=true, casout='scory'}
method="quantile" nBinsArray={3, 3}
;
run;
I think runCodeTable will do it. SAS Help Center: runCodeTable Action
proc cas;
datastep.runcodetable /
codeTable="scory"
casout={name="ac_test ", caslib="dna"}
table={name="AUTO_SEGURO_LEARNER_V11", caslib="dna"}
/* dropvars= */
;
run;
Or, you could try dumping the scoring code to the temp file yourself and running your original dataStep.
data _null_;
file score;
set casuser.scory;
put DataStepSrc;
run;
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.