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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 2 replies
  • 351 views
  • 0 likes
  • 2 in conversation