BookmarkSubscribeRSS Feed

Run a SAS Program Through Score Testing

Started Wednesday by
Modified Wednesday by
Views 87

 

Score testing in SAS Model Manager is incredibly powerful. A user picks a model, a model version, and the data they want scored, and SAS Model Manager handles the rest. The scored data is available in the Cloud Analytics Service (CAS) on SAS Viya in just a few moments. From there, a user can use that data to create a report in SAS Visual Analytics or use it within a flow in SAS Data and AI Studio. SAS Model Manager has supported models with score code types of DATA Step, DS2, Python, or R through score testing as these models can easily be written as a scoring function (see Training code, scoring code, and what makes a model to learn about the general expectations for model scoring code).

 

Recently teams that focus on building and using Risk Models pointed out that many of their models don’t fit into this neat definition of a scoring function, yet they would like to run their models through score testing too. These models are written as SAS Programs, but may use multiple tables as inputs, generate multiple tables as outputs, and leverage additional files within their code. This may sound like a tall order, but in 2026.08 release of SAS Model Manager, SAS Programs can now run through score testing. Additionally, with a few small changes to the SAS Program code, users can also leverage multiple tables and files

 

Updating Your SAS Program for Running in a Score Test

 

To prepare  your SAS Program for running in a SAS Model Manager score test, there are a few things you’ll need to update in your code. If you are interacting with the SAS Program within the SAS Model Manager Graphical User Interface, you’ll also be prompted to add this information if it is missing anywhere.

 

  1. Define your input data library name as &inputlib. This helps SAS Model Manager map the library you choose in the score testing dialog to the library used in the SAS Program.
    Libname <your-name-of-choice> &inputlb;
  2. Define your output data library name as &outputlib. This helps SAS Model Manager map the library you choose in the score testing dialog to the library used in the SAS Program.
    Libname <your-name-of-choice> & outputlib;
  3. The Results tab in the Scoring Test displays one table. You can choose not to display any tables here but if there is a table you would like to display, assign it to  &_MM_OutputDS. 
    DATA &_MM_OutputDs; set <your-output-table>; run;
  4. If you would like to use a file in your SAS Program, upload it to the model files and set it as a Scoring Resource. You can then refer to it in your code via a filename statement using the file’s name as the macro variable. Note that period’s are not supported in macro names, so “.” will be replaced with “_”. If your file name is “myAwesomeFile.csv”, the macro variable to refer to it will be “&myAwesomeFile_csv”. 
    Filename <your-name-of-choice> filesrvs “&nameOfFileinMM_extention”;
  5. Since this score test will be running through CAS, you need to ensure that your program only includes CAS-safe actions. For examples, in CAS you cannot sort in place via PROC SORT, but you can create a new table for the sorted table and move forward with the new sorted data. 

 

Now to run the SAS Program in SAS Model Manager in a Score Test, select the input and output CAS libraries in the Test Dialog instead of the input table. And once you have updated your code once, it can now run scoring tests as many times as you like in SAS Model Manager.

 

To see this enhancement in action, check out the following demo:

 

(view in My Videos)

 

What would you like to see next for SAS Model Manager? let us know in the comments!

Contributors
Version history
Last update:
Wednesday
Updated by:

Viya Copilot Motion Graphic.gifViya Copilot Motion Graphic

Ready to see what SAS Viya Copilot can do?

Visit the Tips & Tricks page for setup guidance, demos, and practical examples that show how Copilot supports your workflows.

Get Started →

SAS AI and Machine Learning Courses

The rapid growth of AI technologies is driving an AI skills gap and demand for AI talent. Ready to grow your AI literacy? SAS offers free ways to get started for beginners, business leaders, and analytics professionals of all skill levels. Your future self will thank you.

Get started

Article Labels
Article Tags