BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
acordes
Rhodochrosite | Level 12

The following code works and derives a score as expected, even the download and upload execute without errors and show the expected results.

BUT when I close the session and come back, I cannot re-activate the scoring code.  

How Do I make it survive the session?

 


cas mySession sessopts=(caslib='casuser');
PROC CAS;
regression.glm
      table={name='rema', caslib='casuser', groupby={'_brand'}, where=" _o_sales_res ne .", 
                                                           computedvars='months_since_covid', 
                                                           computedvarsprogram="months_since_covid= intck('month', '15mar2020'd, today())"},
      class={{name={'/msi_model\b|_gama_agg\b/'}}
},
      model={ depVar='RMNVALORVENTA',
              effects={{ vars='/_gama_agg|MESES_EFECTIVOS|_o_actual_mileage/'
interact='bar'   ,maxinteract=1 }
, {vars={ 'poly'}}
}},       
selection={method='forward'}, spline={{basis="BSPLINE",
dataBoundary=false, degree=2, vars={'months_since_covid'}, name="spl"}
}, 
polynomial={{
degree=2,
mdegree=2,
details=TRUE,
labelStyle={
expand=TRUE
exponent="^"
includeName=TRUE
productSymbol="NONE"
},
name='poly',
vars={"MESES_EFECTIVOS"}
}},
      output={casOut={name='out1', replace=true},  
              copyVars="ALL_MODEL",
              pred='pred', resid='resid', role='role'}, outputtables={includeall=true, replace=true} 
store={name='myModel', replace=true};
run;

proc cas;
   regression.glmScore
      restore='myModel',
/*       restore={caslib='casuser', name='VR_ABS_SIMPLE'}, */
      table={name='rema', caslib='casuser', groupby={'_brand'}, where="1=1"},
      fitData='false',
      casOut={name='out2', replace=true, caslib='mkt'},
/*     copyVars="ALL", */
      pred='pred', resid='resid', rstudent='rstudent';
run;

proc astore;
describe rstore=casuser.MYMODEL ;
quit;

proc astore;
download rstore=casuser.MYMODEL
store='VR_ABS_SIMPLE';
quit;

proc astore;
upload rstore=casuser.model_restored
store='VR_ABS_SIMPLE';
describe rstore=casuser.model_restored;
quit;
1 ACCEPTED SOLUTION

Accepted Solutions
acordes
Rhodochrosite | Level 12

Now it works,

just added these lines to save as sashdat to recover later. 

I had made these before but with the compress option in the save statement, not a good idea for astores...

 


%let DEST_LIB=casuser; /* The CAS library where the destination data should go */
%let DEST_DATA=MYMODEL; /* The CAS table name where the destination data should go */

proc casutil;
  Save casdata="&DEST_DATA" incaslib="&DEST_LIB" casout="&DEST_DATA%str(.)sashdat" outcaslib="Models" replace;
Quit;

proc casutil;
load casdata="MYMODEL.sashdat" incaslib="Models"
casout="VR_ABS_SIMPLE" outcaslib="casuser" replace;
run;

View solution in original post

2 REPLIES 2
acordes
Rhodochrosite | Level 12

Now it works,

just added these lines to save as sashdat to recover later. 

I had made these before but with the compress option in the save statement, not a good idea for astores...

 


%let DEST_LIB=casuser; /* The CAS library where the destination data should go */
%let DEST_DATA=MYMODEL; /* The CAS table name where the destination data should go */

proc casutil;
  Save casdata="&DEST_DATA" incaslib="&DEST_LIB" casout="&DEST_DATA%str(.)sashdat" outcaslib="Models" replace;
Quit;

proc casutil;
load casdata="MYMODEL.sashdat" incaslib="Models"
casout="VR_ABS_SIMPLE" outcaslib="casuser" replace;
run;
mkeintz
PROC Star

@acordes wrote:

Now it works,

just added these lines to save as sashdat to recover later. 

I had made these before but with the compress option in the save statement, not a good idea for astores...

.... stuff deleted ...

Excellent.

 

Now mark your own second note as the solution, so people know that there is a solution.

 

 

 

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 857 views
  • 0 likes
  • 2 in conversation