I am developing some models in visual analysis, developing 3 models, and I have already chosen which was the winning model, in this case a neural network, I want to export my punctuation code to be able to take it to sas studio, but it has generated many doubts, I don't know exactly where I must pass the new data that I need punctually to the punctuation code that generated the model.
I attach images of the code that is generated in visual analysis.
this code has about 124,887 lines
That's a common task when you model in visual analytics.
It depends on the algorithm you use for learning the model.
Some require astore technique for scoring and some generate sas code that you can %include like @Reeza said.
Those creating an astore let you know by asking for a table name. This means the scoring code is written to the models caslib. These models require other techniques for scoring.
I show you both ways of scoring. the first for a linear regression as example. You create a txt file with the scoring code from VA and reference and include it.
FILENAME REFFILE FILESRVC FOLDERPATH='/Projects/SAS Viya training VWFS/' FILENAME='_2B3_aux lin_reg_sales_res.txt';
data casuser.rema_scored;
set casuser.rema;
%include reffile;
run;
The second one gets implemented by copy-pasting the score code from the VA window (after setting a name for the model) to sas studio. Put the macro variables specific to your environment and run the code.
there are other scoring techniques like missing value trick, ds2, astore, ...
here comes proc astore:
proc casutil;
load casdata="GB_sales_res_example.sashdat" incaslib="Models"
casout="GB_example" outcaslib="casuser";
run;
proc astore;
describe rstore=casuser.gb_example;
quit;
proc astore;
score data=casuser.rema copyvars=meses_efectivos
rstore=casuser.gb_example
/* epcode="/caslibs/marketing/dmcas_epscorecode.sas" */
out=casuser.rema_scored_astore;
run;
Well posting just commented code isn't super helpful.
But typically you'd take the score code and insert it into a data step - something like this:
data scored_data;
set new_input_data;
*insert code from scoring;
run;
Thank you for such a quick response, I have one more question, is it possible to call this sas code, from another sas file, to do what you suggest and not have to open it and append the lines you suggest?
data scored_data;
set new_input_data;
%include 'path to files with code' / source2;
run;
@sateh wrote:
Thank you for such a quick response, I have one more question, is it possible to call this sas code, from another sas file, to do what you suggest and not have to open it and append the lines you suggest?
That's a common task when you model in visual analytics.
It depends on the algorithm you use for learning the model.
Some require astore technique for scoring and some generate sas code that you can %include like @Reeza said.
Those creating an astore let you know by asking for a table name. This means the scoring code is written to the models caslib. These models require other techniques for scoring.
I show you both ways of scoring. the first for a linear regression as example. You create a txt file with the scoring code from VA and reference and include it.
FILENAME REFFILE FILESRVC FOLDERPATH='/Projects/SAS Viya training VWFS/' FILENAME='_2B3_aux lin_reg_sales_res.txt';
data casuser.rema_scored;
set casuser.rema;
%include reffile;
run;
The second one gets implemented by copy-pasting the score code from the VA window (after setting a name for the model) to sas studio. Put the macro variables specific to your environment and run the code.
there are other scoring techniques like missing value trick, ds2, astore, ...
here comes proc astore:
proc casutil;
load casdata="GB_sales_res_example.sashdat" incaslib="Models"
casout="GB_example" outcaslib="casuser";
run;
proc astore;
describe rstore=casuser.gb_example;
quit;
proc astore;
score data=casuser.rema copyvars=meses_efectivos
rstore=casuser.gb_example
/* epcode="/caslibs/marketing/dmcas_epscorecode.sas" */
out=casuser.rema_scored_astore;
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.
Find more tutorials on the SAS Users YouTube channel.