SAS Viya Copilot for Code Assistance in SAS Data and AI Studio
Recent Library Articles
In this post, we’ll take a look at how SAS Viya Copilot for Code Assistance can help with some of those everyday tasks: understanding code, improving it, and making changes more confidently—all without leaving the SAS Data and AI Studio environment.
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.
APIs are everywhere. They provide access to public data, cloud services, business applications and countless other resources. And if you use SAS, you don't need another programming language just to take advantage of them.
With PROC HTTP and a few supporting SAS features, you can call REST APIs, retrieve data, process JSON responses and incorporate web services directly into your SAS programs.
Here are five tips to help you do it successfully, taken from this recent Ask the Expert webinar about "Harnessing REST APIs with SAS".
1. Use PROC HTTP when you need real API power
For a simple HTTP GET, FILENAME URL can be wonderfully concise. But APIs often require much more: POST or PUT methods, authentication, request headers, control over the response and detailed error handling.
That's where PROC HTTP shines.
A typical request follows a straightforward pattern: specify the URL, choose the HTTP method and direct the response to a fileref. PROC HTTP supports GET, POST, PUT and other HTTP methods, along with options for authentication, caching, cookies and debugging.
Think of PROC HTTP as the SAS-language counterpart to tools such as cURL. When an API interaction becomes more than "fetch this URL," PROC HTTP should usually be your starting point.
2. Don't assume that a completed PROC HTTP step means success
One of the most important API programming habits is checking what actually came back.
HTTP errors don't necessarily produce SAS errors. Your PROC HTTP step can finish normally while the server responds with something you weren't expecting.
After a request, check the automatic macro variables SYS_PROCHTTP_STATUS_CODE and SYS_PROCHTTP_STATUS_PHRASE .
A status of 200 OK generally means the request succeeded, but other codes tell important stories:
401 or 403: authentication or authorization problem
404: the requested resource wasn't found
429: you've hit the API's rate limit
500 or 503: the API itself is experiencing trouble
Build these checks into your production programs instead of discovering the problem several DATA steps later. Example:
%if (&SYS_PROCHTTP_STATUS_CODE. = 200) %then %do;
/* to examine response data ---
data _null_; rc=jsonpp('respjs','log'); run;
*/
%end;
And don't stop at the HTTP status. Verify that the response contains the data structures you expect before trying to use them. For JSON responses, for example, you can use the EXIST function to confirm that an expected table was created. Example:
/* Make sure expected data is in JSON library */
%if %sysfunc(exist(stream.alldata)) %then %do;
data all;
set stream.alldata;
run;
%end;
3. Let the JSON LIBNAME engine do the heavy lifting
JSON is one of the most common formats returned by REST APIs. Fortunately, you don't usually need to write your own JSON parser.
Capture the PROC HTTP response in a fileref and assign the JSON LIBNAME engine to it. SAS can then expose elements of the JSON document as familiar SAS tables.
That means an API workflow can this simple:
Call the API → receive JSON → assign a JSON library → use SAS procedures or DATA steps.
For troubleshooting, the JSONPP function is also useful for "pretty printing" a JSON response to the SAS log or a file. It lets you see the structure you're working with before you start writing code against it.
4. Treat authentication as part of your API design
Many useful APIs require authentication. PROC HTTP supports authentication options including Basic authentication with AUTH_BASIC , WEBUSERNAME and WEBPASSWORD .
More sophisticated services can require considerably more. Microsoft 365, for example, can be accessed from SAS through Microsoft Graph, enabling SAS programs to interact with resources in SharePoint and OneDrive.
The larger lesson is to understand the authentication model before you build the rest of your program. A perfect GET or POST request isn't very useful if you're not able to establish the credentials, tokens or permissions required by the service.
And in real applications, don't hard-code secrets into programs that will be shared or stored in source control.
5. Test the HTTP mechanics separately from your application logic
When you're learning PROC HTTP or debugging a request, it helps tremendously to have a predictable endpoint.
httpbin.org is designed for exactly this sort of testing. You can experiment with GET and POST requests, authentication, headers and responses without depending on the
behavior of your real API.
This makes it easier to answer an important debugging question: Is the problem in my SAS HTTP code, or in the service I'm trying to call?
Once the basic request behaves as expected, substitute the real API endpoint and add the application-specific processing.
From web request to SAS data
The real advantage of accessing APIs from SAS isn't simply that PROC HTTP can retrieve something from the internet. It's what you can do next.
A SAS program can retrieve public data from an API, parse a JSON response into SAS tables, download and read a ZIP archive, POST information to another service or connect SAS workflows with cloud platforms such as Microsoft 365.
The web isn't just for browsers, and APIs aren't just for Python and JavaScript developers. With PROC HTTP and the rest of the SAS language at your disposal, your SAS program can be a full-fledged web client too.
... View more
by Cornelia Reitinger What Liverpool FC, WWF, Istantbul Airport, Global Blue and Komerční banka taught me about data, AI and the technology behind customer loyalty.
Last week, I joined my colleagues and delegates at SAS Martech Connect 2026. I’ve been back for a few days now, looking through the notes I took while listening to some incredible speakers and customers talk about how they use AI and data to drive customer engagement and build stronger loyalty.
I may be biased, but it really was an incredible 2 days organised by our marketing team. I loved the conversations, the mix of perspectives and meeting so many new people at the event.
Ken Hughes kicked off Day 1 with his keynote. He’s a consumer behaviouralist and customer experience strategist, and one of the most booked keynote speakers on the subject. One point that stuck with me from his talk was the distinction between a transactionally loyal customer and an emotionally loyal one, something I never really thought much about.
Based on his examples, I’m a transactionally loyal customer when it comes to my phone provider. The moment I find a better deal and switching is relatively convenient, I’m gone. I’m not emotionally connected at all.
I’m no Swiftie for my phone contract.
Taylor Swift is a masterclass in building a brand. Not exactly news. I’ll admit I still don’t fully understand Swifties, but Taylor clearly knows how to make them feel special. They feel heard. They feel seen.
On screen, Ken showed us a young girl in tears simply because she was at the concert. Honestly, part of me found that really uncomfortable. I’m not sure I’d want any brand to have that kind of hold on a teenager. But if a brand can make a customer feel even a tiny fraction of that recognition and belonging, you’ve won.
How many brands get anywhere close?
The fan behind every interaction
Someone who certainly has a stronger emotional connection with their audience than the average phone operator is Liverpool Football Club. Chris Jennions, VP of Marketing at Liverpool FC, joined SAS’s Mike Blanchard on stage to talk about it.
A Liverpool fan may not cry when the team walks onto the pitch, but I’ve certainly seen fans cry when their team scores a goal.
Liverpool Football Club has a longstanding connection with the city. The club is part of Liverpool’s DNA, while over the years it has also built a huge global fan base.
Those fans attend matches, buy merchandise and purchase memberships and hospitality. But the club’s challenge was to see one person across all of those relationships with the club, rather than a string of separate interactions.
Bringing data, processes and teams together allows the club to build a more connected understanding of the fan and make interactions more relevant and personal.
And that means it can build on the emotional connection that already exists.
It’s the “Blue Dot Consumer” idea Ken Hughes talked about. Like the blue dot on your maps app, the customer sits at the centre, and everything is viewed from where they stand.
AI agents are the easy bit
Komerční banka and Trask brought everything back down to earth with a very practical presentation on AI agents and accelerating CRM.
Gabriela Pithartová from Komerční banka and Terézia Čemová from Trask, whom I’d had the pleasure of meeting at the Women in MarTech lunch earlier that day, managed to keep everyone’s attention despite it already being late in the afternoon.
Gabriela’s message was refreshingly pragmatic: it’s easy to build an agent. Making one work in a bank is a different matter.
Komerční banka has been progressively scaling its customer engagement operation. In 2025, it launched 357 new campaigns. By May 2026, it had launched another 171, against an ambition to scale beyond 500. It has expanded into triggered campaigns, payment notifications, activation journeys and real-time scenarios.
And I think that background is crucial.
Komerční banka didn’t start with an AI agent and then go looking for a problem to solve.
It spent years building the underlying machinery: event triggers, customer data, decisioning, contact policies, channels and measurement. The agents were introduced later as a way of making that machinery easier and faster to operate.
There’s a lesson in there for all the organisations rushing to “do something with agents”.
AI doesn’t remove the hard work that came before it. It makes good foundations more valuable.
When context becomes data
Levent Oral, Head of Marketing and Sales at İGA Istanbul Airport, and Demet Yarkın, Chief Experience Officer at Partner Republic, showcased something quite different: how to bring together physical behaviour, digital signals and real-time decisioning to understand a passenger in context.
The airport connects signals from WhatsApp, Wi-Fi, its mobile app, transactions, push notifications and location services. These interactions could easily remain disconnected. Instead, İGA Istanbul Airport uses them to understand what might be relevant to a particular passenger right now.
That last part is important: Knowing who the passenger is isn’t enough. It’s about understanding where they are and what they might need at that particular moment.
That could mean navigation help when approaching security, a timely travel reminder or a relevant retail opportunity once they are through security.
And the result isn’t only a smoother passenger experience but also an increase in overall revenue and in İGA Pass membership in the initiative.
They haven’t simply asked, "How do we personalise our marketing?"
They’ve asked a much better question: How do we connect fragmented passenger signals quickly enough to understand someone’s situation and take the right action while it’s still relevant?
For me, that is where personalisation gets much more interesting. Context becomes data.
Winning the donor is only the beginning
Not every customer relationship starts in an app or with a digital signal.
Lucas Kelly, Senior Data Scientist at WWF, brought a completely different perspective.
Their example started on the street, quite literally. Someone stops to talk to a fundraiser, has a human conversation about a cause they care about and signs up to make a regular donation.
That’s a successful acquisition. But will it be a successful relationship?
The real challenge starts afterwards. That very human interaction on the street suddenly becomes emails, messages and automated communications. The person who signed up because they felt an emotional connection to the cause becomes another donor in a database. Over time, some disengage and some cancel sooner or later.
WWF showcased how they use predictive scoring to understand a donor’s likelihood of churning based on the interaction with their communications. This allows them to identify donors at greater risk of leaving and they use Next Best Action to decide how to best engage them, rather than treating every donor the same way.
I loved this example because it brings us straight back to Ken Hughes and emotional loyalty.
A charity starts with something most commercial brands would love to have: the person already cares. But even emotional connections need looking after.
Acquisition is the starting point, and getting someone to say yes once is relatively easy compared with giving them enough reason to keep saying yes.
Data isn’t the destination
Janki Patel, Head of Data at Global Blue, approached the problem from yet another angle in her session, "From Data to Destinations: Using SAS Journeys to Drive Engagement and Conversion." Her role focuses on data strategy and turning customer data into actionable business insight, and she previously led consumer engagement solutions, data and insights at Global Blue.
And I think there’s an important distinction in that.
Most large organisations today don’t suffer from a shortage of customer data. Quite the opposite. We collect enormous amounts of it. Knowing more about a customer doesn’t automatically make their experience any better.
The Global Blue story was about turning insight into action. The focus on journeys is about taking what you know about customers, using that knowledge to shape what happens next, and then measuring whether that interaction actually changed behaviour. The session itself was explicitly framed around using journeys to drive engagement and conversion.
It sounds obvious, but there is a huge difference between having customer data and being able to act on customer data.
We talk a lot about personalisation, AI, agents, real-time decisioning and data. And how MarTech has changed in the last few years, especially with AI, is remarkable. But even incredibly powerful technology can only prove its value when you look at what organisations are able to do differently with it.
Liverpool Football Club is trying to recognise one fan across many different relationships with the club.
Komerční banka has built the foundations and is now exploring how agents can make an already sophisticated CRM operation faster.
İGA Istanbul Airport is trying to understand what a passenger needs at this particular moment.
WWF is thinking about how to sustain a relationship after that first emotional commitment.
And Global Blue is tackling the gap between knowing something about a customer and actually turning that knowledge into an interaction that changes behaviour.
Very different organisations. Very different customers.
But actually, a surprisingly similar problem: How do you understand enough about an individual, and their context, to make the next interaction worth having?
Maybe that’s where the Blue Dot Consumer becomes more than a nice metaphor.
Putting customers at the centre isn’t about drawing them in the middle of another customer journey diagram. It’s about genuinely changing your perspective.
Instead of starting with:
What do we want to sell, say or promote next?
Start with:
Where is this person right now? What do we already know? And what would actually be useful, interesting or relevant from where they stand?
AI can help answer that question faster. Data can help answer it more accurately. Agents can help companies act on the answer at a scale no team could manage manually.
But none of those things creates loyalty on its own.
The Taylor Swift example keeps coming back to me because nobody becomes a Swiftie because Taylor has a brilliant MarTech stack.
The right technology helps make those relationships possible at scale, but the relationship itself comes from feeling recognised, understood and part of something.
Most brands aren’t going to make their customers cry, which is probably a good thing. But making them feel seen might be a pretty good place to start. NOTE: This article was origialy published here: Nob target=_blankody becomes a Swiftie because of the Martech stack
... View more
I keep running into an issue where, when I export a report from SAS Viya to a PDF (in A4 portrait format), the result does not match what I see in SAS Viya. How can I ensure that what I see on screen is exactly what I get in the A4 PDF output?
... View more
Hello everyone, I’m preparing for a migration from SAS Financial Management on SAS 9.4 to Financial Management within SAS Intelligent Performance Management (IPM) on SAS Viya. The planned route is: FM 5.6 → FM 5.62 on SAS 9.4M8 in a separate environment → FM within IPM on Viya. Could you recommend learning resources covering: FM fundamentals: models, dimensions, hierarchies, cycles, rules, forms and data loading. FM on Viya: functional differences and considerations when transferring existing FM processes. Migration implementation: product-specific tools, prerequisites, limitations, manual adaptations and validation. I have found the SAS Financial Management 5.6: Data Administrator’s Guide. Are there introductory courses, recorded demonstrations or hands-on exercises available for FM 5.6/5.62 and FM within IPM? Any recommendations for a learning sequence or relevant documentation sections would be greatly appreciated. Thank you for your guidance!
... View more