BookmarkSubscribeRSS Feed
acordes
Rhodochrosite | Level 12

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; 
3 REPLIES 3
DerylHollick
SAS Employee

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; 

  

acordes
Rhodochrosite | Level 12

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;

 

DerylHollick
SAS Employee

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;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 303 views
  • 0 likes
  • 2 in conversation