The ASTORE Procedure
Example 3.6 Scoring with Multiple Stores That Form a DAG
This example first shows how to produce an analytic store that is created by the transform action. For more information about the transform action, see Chapter 10, Data Science Pilot Action Set (SAS Visual Data Mining and Machine Learning: Programming Guide).
This example uses the same home equity data table (mycas.hmeq) that is loaded in the session as described in the section Home Equity Data Set. The transform action imputes the two variables value and mortdue and produces the output table mycas.hmeq_t. The savestate parameter in the following transform action code saves the state in an analytic store, which is stored in the table mycas.transform.
proc cas;
dataPreprocess.transform table='hmeq'
reqpacks={{name='t1' impute={method="median"} inputs={"value"}},
{name='t2' impute={method="mean"} inputs={"mortdue"}}}
copyvars=${id loan reason job delinq ninq bad}
casout={name='hmeq_t' replace=true}
savestate={name='transform' replace=true};
quit;
The following PROC SVMACHINE call specifies the input table mycas.hmeq_t, which is the output table from the preceding transform action. It also specifies the variables loan, t2_mortdue, and t1_value as interval variables, where t2_mortdue and t1_value are imputed from the original variables mortdue and value, respectively. The SAVESTATE statement saves the state of the SVMACHINE procedure in a new analytic store, which is stored in the table mycas.savehmeq3.
proc svmachine data=mycas.hmeq_t;
input loan t2_mortdue t1_value/level=interval;
input reason job delinq ninq /level=nominal;
target bad;
id id;
savestate rstore=mycas.savehmeq3;
run;
The following statements score the mycas.hmeq table by using two analytic stores, which are stored in the tables mycas.savehmeq3 and mycas.transform, to produce the output table mycas.out. Notice that the store mycas.savehmeq3 depends on the store mycas.transform, because the two input variables t2_mortdue and t1_value of the store mycas.savehmeq3 are the output variables of the store mycas.transform.
proc astore;
score rstore=mycas.savehmeq3 rstore=mycas.transform data=mycas.hmeq
copyvars=(id) out=mycas.out;
run;