Modernizing from SAS 9.4 to Viya with SAS Managed Cloud Services
Recent Library Articles
Modernizing from SAS 9.4 to Viya takes more than a cloud move—it requires a new operating model. This article explains why lift-and-shift falls short and how SAS Managed Cloud Services helps organizations modernize faster, reduce complexity, and improve outcomes.
Already a SAS Viya user? Then you know you’ve got a wealth of capabilities at your fingertips. We’ll explore those together, giving you access to all the insights you’ll need. Join us on December 10 at 11 a.m. ET.
Join this webinar to explore how you can work fast with less repetitive effort and build workflows that improve efficiency.
You will learn about:
Productivity shortcuts that save time and reduce repetitive tasks.
Features for managing projects and library paths.
Ways to customize the interface and automate routine activities.
Register Now
... View more
Join this webinar to explore how SAS Model Studio can help you bring structured and unstructured data together.
You will learn how to:
Build a single Model Studio pipeline that combines structured data with text-derived features, then compare predictive models with and without those features.
Refine text analysis using concept rules, topic exploration and in-pipeline filtering.
Understand how automatic language detection supports language-specific pipelines.
Register Now
... View more
Join this webinar to explore how SAS Viya Workbench provides a unified development environment.
You will:
Explore how Git supports version control and collaboration in SAS Viya Workbench.
Discover how SAS Viya Copilot assists with code generation, explanation, debugging and improvement.
See how SAS, PROC SQL and Python work together in SAS Viya Workbench to support efficient, reproducible, end-to-end analytics.
Register Now
... View more
NEW SAS ® VIYA ® FEATURES
Into the Viya Verse
See what’s new in under 10 minutes. David Weik walks through this month’s SAS Viya updates.
Watch now
SAS Data Governance: Natural language search with SAS Viya Copilot
SAS Data Governance now supports natural language search with SAS Viya Copilot, making it easier to find relevant assets and information. Users can enter a question or search request in everyday language on the home page, and Copilot interprets the query to help locate the most relevant assets. This simplifies asset discovery, reduces the need for complex search criteria, and helps users find information more efficiently.
Explore the feature
SAS Data and AI Studio: HTML editor
SAS Data and AI Studio includes an editor for viewing and editing HTML files (*.html). With the HTML editor, you can open, view, edit and save HTML files that are stored in SAS Server or SAS Content locations.
Explore the feature
SAS Visual Analytics: Generate a new calculated data item
You can now use the generative AI capabilities of SAS Viya Copilot to create calculated data items using natural language prompts. Instead of manually building expressions, users can describe the calculation they need in plain language, and Copilot generates the calculated data item for them. This helps streamline report creation, reduce manual effort and make advanced calculations more accessible to a wider range of users.
Explore the feature
SAS Visual Analytics: Enhanced performance setting
Creating complex business metrics and conditional aggregations often requires syntax knowledge and the ability to navigate nested functions and expression builders. With SAS Viya Copilot in SAS Visual Analytics, you can now bypass the manual formula editor and generate calculated data items using natural language or voice input. Simply describe the intended logic and SAS Viya Copilot translates your intent into valid syntax while allowing you to reference data items directly via # tagging.
Explore the feature
Browse all release notes
Want to see what else is new? Explore the full list of updates at your own pace.
Browse release notes
Tip of the month
Brought to you by David Weik
Senior Systems Architect, SAS
Quick tip: In this edition, we will revisit the topic of snippets, which we’ve discussed in previous editions.
What I’d like to highlight is that snippets aren't just for SAS code; they are supported in all file types in SAS Data and AI Studio.
Personally, I’ve been building a number of Markdown-specific snippets that let me quickly add changelog entries or create new READMEs using my preferred chapter structure.
So the next time you find yourself copying content between files, take a step back and ask yourself if that content could become a snippet that you can use again and again.
... View more
Measuring bias tells you a problem exists. Reducing it is the next step.
In Part 1 we used PROC ASSESSBIAS to surface a fairness gap that overall accuracy had hidden. In this tutorial we retrain the same model with the MITIGATEBIAS statement, which applies fairness constraints while the model is being built rather than after it is finished.
This article is the second in a three-part series based on Vrushali Sawant's SAS Innovate 2026 session, 11 Essential SAS Procedures in SAS Viya Workbench for Building and Governing Trustworthy AI. It uses the same UCI Adult Income data set and the example program adult_income_mitigate_bias.sas from the SAS Trustworthy AI Examples repository.
In this tutorial you'll learn how to:
Re-establish the baseline bias measurement from Part 1
Retrain a random forest model with the MITIGATEBIAS statement
Understand how in-processing bias mitigation works
Read the iteration history to compare fairness and accuracy before and after mitigation
Before you begin
This tutorial assumes you have completed Part 1 in this series, or at least cloned the examples repository into your Workbench workspace. If you have not, open a terminal (Terminal > New Terminal) and run:
cd /workspaces/myfolder
git clone https://github.com/sassoftware/sas-trustworthy-ai-examples.git
cd sas-trustworthy-ai-examples
Run these in the Workbench Terminal, not in a SAS program. Pasting shell commands into a .sas file produces ERROR 180-322.
The example program used here is sas/adult_income_mitigate_bias.sas . It repeats the full baseline pipeline before applying mitigation, so the program runs start to finish on its own. The full run takes about two and a half minutes, most of it in the mitigation step.
Run each SAS code block in this article in the same Workbench session, in order. The data sets they create live in the WORK library, which is cleared when a session ends. If you start a new session, begin again at Step 1.
Re-establish the baseline
The mitigation example begins by repeating the baseline from Part 1:
Import the data.
Train a random forest with PROC FOREST.
Run PROC ASSESSBIAS.
This creates a baseline measurement that you can compare with the results after mitigation.
Step 1: Import the data
Read the training and test files from the cloned repository into the WORK library. &WORKSPACE_PATH resolves to your Workbench workspace root.
proc import
datafile="&WORKSPACE_PATH./sas-trustworthy-ai-examples/data/adult_train.csv"
out=adult_train dbms=csv replace;
run;
proc import
datafile="&WORKSPACE_PATH./sas-trustworthy-ai-examples/data/adult_test.csv"
out=adult_test dbms=csv replace;
run;
The log should report 19,537 observations in WORK.ADULT_TRAIN and 16,281 in WORK.ADULT_TEST, each with 15 variables.
Step 2: Train the baseline model
Train the same random forest used in Part 1. The OUTPUT statement creates adult_scored , which holds the predicted probability columns that both PROC ASSESSBIAS and MITIGATEBIAS refer to.
title2 'FOREST on adult_train data';
proc forest data=adult_train seed=12345;
input age fnlwgt education_num capital_gain
capital_loss hours_per_week / level=interval;
input workclass education marital_status occupation
relationship race sex native_country / level=nominal;
target target / level=nominal;
savestate rstore=dtstore;
output out=adult_scored copyVars=(_ALL_);
run;
The full example program also scores the test data and saves the analytic store to a file, as shown in Part 1.
Step 3: Measure baseline bias
title2 'ASSESSBIAS on baseline model';
proc assessbias data=adult_scored ncuts=5 nbins=5;
var P_target_50K;
target I_target / event=">50K"
level=nominal;
fitstat pvar=P_target__50K /
pevent="<=50K";
sensitiveVar sex;
run;
Figure 1. Baseline bias metrics from PROC ASSESSBIAS. Demographic parity is 0.1678: the model predicts income above $50K for about 24% of men and about 7% of women. This is the gap the mitigation step works to reduce.
Verify the probability column names
MITIGATEBIAS requires you to name the posterior probability columns the model produces. Those names are generated from the target variable and its class levels, so confirm them before running the mitigation step:
proc contents data=adult_scored;
run;
The example expects P_target_50K for the ">50K" event and P_target__50K for the "<=50K" event. If your output uses different names, substitute them in Step 3 and in the PVARS= option in Step 4.
How MITIGATEBIAS works
There are three general points in a modeling workflow where bias can be addressed: before training by adjusting the data, during training by constraining how the model is fit, and after training by adjusting the predictions. The MITIGATEBIAS statement is an in-processing method, meaning it acts during training.
Internally, it uses an exponentiated gradient reduction (EGR) algorithm. The algorithm repeatedly adjusts observation weights and refits the classifier, working to reduce the selected fairness metric across successive iterations. Because it wraps the underlying model rather than replacing it, the predictors, target and forest settings you already use stay the same.
By default, the statement minimizes demographic parity. It also supports equalized odds, equal opportunity and predictive parity.
Step 4: Retrain the model with bias mitigation
The INPUT and TARGET statements are identical to the baseline model. The MITIGATEBIAS statement is added, and the OUTPUT statement is not needed. SAVESTATE is required when MITIGATEBIAS is used, and here it overwrites dtstore so the mitigated model replaces the baseline in the analytic store.
title2 'FOREST with bias mitigation on adult_train data';
proc forest data=adult_train seed=12345;
input age fnlwgt education_num capital_gain
capital_loss hours_per_week / level=interval;
input workclass education marital_status occupation
relationship race sex native_country / level=nominal;
target target / level=nominal;
savestate rstore=dtstore;
mitigateBias pevents=">50K <=50K"
pvars=(P_target_50K P_target__50K)
seed=12345
sensitivevar=sex
targetEvent=">50K";
run;
This step takes about two minutes, because each iteration fits a new forest.
Figure 2. EGR iteration history from the MITIGATEBIAS statement. Demographic parity falls from 0.168 to 0.046 across 10 iterations, while the misclassification rate rises from 0.127 to 0.139.
Understanding the mitigation options
Option
Purpose
PVARS=
Lists the posterior probability columns the model produces, one per class.
PEVENTS=
Lists the class events those probability columns correspond to, in the same order as PVARS=.
SENSITIVEVAR=
Designates the protected demographic attribute the algorithm balances across. Here, sex.
TARGETEVENT=
Names the positive outcome the fairness review focuses on. Here, an income above $50K.
SEED=
Makes the reweighting reproducible from run to run.
Because no BIASMETRIC= option is specified, the statement minimizes demographic parity by default. That is the same metric measured in the baseline, which keeps the before-and-after comparison like for like.
What the results show
Across 10 iterations, demographic parity fell from 0.168 to 0.046, a reduction of about 73%. The misclassification rate rose from 12.7% to 13.9%, a modest cost in accuracy for a much smaller gap between groups.
Iteration 1 matches the baseline PROC ASSESSBIAS result, so the iteration history is a direct before-and-after comparison. Presenting the fairness metric next to the misclassification rate answers the question a reviewer or auditor will ask: did fairness improve, and what did it cost in predictive performance?
Summary
In this tutorial you learned how to:
Re-establish the baseline demographic parity measurement from Part 1
Confirm the posterior probability column names the model produces
Retrain a random forest with the MITIGATEBIAS statement
Read the iteration history to compare fairness and accuracy before and after mitigation
Measurement and mitigation are two halves of the same workflow. PROC ASSESSBIAS surfaces a disparity and MITIGATEBIAS reduces it during training, in the same procedure you already use to build the model. In Part 3, we'll turn to evaluating and explaining the model, comparing performance across demographic subgroups with PROC ASSESS and examining why a model made a particular prediction.
Relevant Links
Session landing page and deck PDF on SAS Communities
SAS Trustworthy AI Examples on GitHub
MITIGATEBIAS statement syntax documentation (SAS Help Center)
PROC ASSESSBIAS syntax documentation (SAS Help Center)
... View more