The three components you need to use agentic AI with SAS

1

A practical guide to using Agentic AI in a SAS 9 programming workflow

Most SAS 9 programmers are used to writing the code, running it, checking the log, fixing what broke, and running it again. Agentic AI can take on parts of that loop, but only if it can do more than answer a question. It needs to write or revise code, run it, inspect the results, and keep working until the output meets the goal.

For SAS 9 programmers, the setup is not as simple as picking an AI model and turning it loose. SAS 9.4 is not built for agentic AI in the same way newer SAS Viya environments are, so you need a bridge between the AI tool and the SAS 9 environment. A useful way to think about it is in three parts: the interface, the agentic AI tool, and the connection back to SAS 9.

1. The interface: Where the work happens

The interface is where you give the AI its instructions, watch what it is doing, and step in when needed. You can use a command line, an IDE such as Visual Studio Code, or a chat-like interface. For SAS 9 programmers, the IDE option is usually the most practical because you can see the generated SAS code, files, logs, and agent conversation in one place.

That visibility matters. If the agent is writing DATA steps, PROC REPORT code, PROC SQL, or ODS output, you still need to review the logic, check the log, verify the results, and make sure the output fits the business need.

2. The agentic AI solution: The system that plans, codes, and iterates

The second piece is the agentic AI tool itself. That might be Claude Code, ChatGPT Codex, or another tool. The important point is that the AI can break down a task, use tools, run SAS code, look at the results, fix errors, and try again.

That changes what the SAS 9 programmer does. You are not writing every line by hand. You are explaining the task, giving the agent the data and environment details it needs, and then reviewing what comes back. It is still programming, just one level higher.

That is why SAS knowledge still matters. The AI can help with syntax, boilerplate code, report generation, data exploration, and first-pass debugging. But you still need to know whether the output makes sense, which SAS procedures are appropriate, and where the agent may be taking a shortcut.

3. The SAS connection: The bridge between AI reasoning and SAS execution

The third piece is the connection to SAS 9. This is what turns the workflow from code suggestion into something useful. Without the connection, the agent can write SAS code but cannot test it. With the connection, it can submit the code, read the log, inspect the output, correct mistakes, and keep going.

For SAS 9.4, SASPy is that practical bridge. It lets Python connect to SAS, submit SAS programs, and bring data or ODS results back into Python. That matters because many agentic AI tools are comfortable working in Python, while the SAS program stills runs natively in SAS 9.

This is where SAS 9 differs from Viya. SAS Viya has tools such as SAS Viya MCP that are built for agentic AI. SAS 9.4 needs a more hands-on setup. For many SAS 9 programmers, that means using SASPy with a connection method such as SSH, IOM, or COM so the AI can submit code to the SAS server and bring results back for review.

Want to see it work? Watch the SAS Innovate 2026 demo from Joe Matise, NORC to see Claude Code use SASPy to run SAS 9 code, review results, and fix errors.



Want to get the files? Visit Joe’s GitHib repo.

Prompt engineering is the operating discipline

Prompt engineering is a new part of the programmer’s job in this workflow and includes the agent settings, reusable pre-prompt, and the actual prompt. The settings affect what the agentic AI is able to do. The actual prompt is where you tell the agent what to do, where to put files, which data set to use, what the output should look like, and to run and validate the result for a given project. The reusable pre-prompt is more like onboarding a new employee. It gives the agent the guidance you would give a new SAS programmer: environment details, file path rules, SASPy or Connect SASPy instructions, preferred coding patterns, and reminders to check the log.

Verification, validation, and data handling still matter

Agentic AI can speed up SAS 9 coding, but it does not remove the need for judgment. You still need to review the generated code, inspect the SAS log, confirm that the output was created correctly, and decide whether the results are ready to share.

Data handling deserves the same care. If the work involves sensitive data, know what the AI can see and what your policies allow. One practical pattern is to let the agent work with test or de-identified data, then have a human move the reviewed code into the production environment.

Bottom line

Using Agentic AI with SAS 9 is not just about the AI model. The goal is to set up a workflow where the agent can help, but the SAS programmer still understands, reviews, and owns the result. The three pieces are straightforward: a good interface, an agentic AI tool, and a reliable connection to SAS 9.

When the setup works, Agentic AI can help SAS 9 programmers get to a solid first program faster. It can explore data, generate code, and catch errors, but the programmer still owns the result. The value comes from pairing the AI’s speed with the programmer’s review, validation, and domain expertise.

Learn more

Share

About Author

Susan Kahler

Global Product Marketing Manager, SAS

Susan is a global product marketing manager at SAS, focused on helping customers explore the possibilities of SAS Viya. With a Ph.D. in Human Factors and Ergonomics, she brings a unique perspective on how people learn, work and interact with technology. Her background spans user-centered design, product management, customer insights and operational risk, giving her a practical view of how analytics can improve experiences and drive better outcomes.

1 Comment

  1. Stu Sztukowski on

    One of the other neat things about this approach with saspy for this is that you can also switch this code to run on Viya as well by changing one argument. Simply change the configuration parameter (or modify the existing one) and everything should run the same. For example:

    sas = saspy.SASsession(cfgname='httpsviya')

    This makes a switch to Viya much easier - just set up your authentication and you're still running! And for authentication, I refer to the blog below all the time. Joe Furbee wrote the best article out there:

    https://blogs.sas.com/content/sgf/2023/02/07/authentication-to-sas-viya/

Leave A Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.