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

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

score_code.JPG

1 ACCEPTED SOLUTION

Accepted Solutions
acordes
Rhodochrosite | Level 12

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;

 

pic5.pngpic3.pngpic1b.pngpic1.pngpic2.pngpic6.png

 

View solution in original post

5 REPLIES 5
Reeza
Super User

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;
sateh
Fluorite | Level 6

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?

Reeza
Super User
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?


 

sateh
Fluorite | Level 6
Thank you very much, I will try and tell you how it went!!
acordes
Rhodochrosite | Level 12

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;

 

pic5.pngpic3.pngpic1b.pngpic1.pngpic2.pngpic6.png

 

sas-innovate-2024.png

📢

ANNOUNCEMENT

The early bird rate has been extended! Register by March 18 for just $695 - $100 off the standard rate.

 

Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 

 

Register now!

Tips for filtering data sources in SAS Visual Analytics

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.

Discussion stats
  • 5 replies
  • 839 views
  • 4 likes
  • 3 in conversation