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;
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;
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;
@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.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.