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.
I am working with patient visits data. Each row is a different visit. A patient can have any number of visits, and visits are still ongoing. data pt_visits; INPUT patient $ visit_date :MMDDYY10.; FORMAT visit_date MMDDYY10.; datalines; A 01/12/2026 A 01/16/2026 A 02/04/2026 B 01/05/2026 B 01/09/2026 B 01/10/2026 B 01/18/2026 B 01/31/2026 B 02/05/2026 ; run; Many of the metrics I'm reporting are at the patient level, so I've transposed the data: proc sort data=pt_visits; by patient visit_date; run;
/*count patient visits*/
data pt_visits_ct;
set pt_visits;
by patient;
if first.patient then visit_ct=0;
visit_ct+1;
run;
/*one row per patient*/
proc transpose data=pt_visits_ct out=pt_visits_wide prefix=visit;
by patient;
id visit_ct;
var visit_date;
run; I need to calculate things such as most recent visit and the time that has elapsed since the most recent visit: data calc;
set pt_visits_wide;
last_visit=max(of visit1--visit6);
days_since_last_visit=today()-max(of visit1--visit6);
format last_visit mmddyy10.;
run; My code above uses visit6 in calculations because Patient B, with the most visits, has 6 visits. However, as time goes on and patients have more visits, visit6 will go on to become visit7, then visit8, etc. How can I reference visitn, with n being the number of visits that the patient with the most visits has?
... View more
Hey, just wanted to ask how to approach a mentor or when does a mentor get alloted to you or approach you after the team formation because it's almost 1-2 weeks and there's no mentor allocation to my team.
... View more
Working on multiple concurrent studies in SAS Studio (using v3.8) causes a risk of confusion as each repository is shown using only the directory name of the local repository. In our example this is always the name "programs" as part of a standard folder structure, no matter the client or study. When registering a Git Repository in SAS Studio or Enterprise Guide, it would be valuable to have an additional input field for a user to specify a friendly name or label to be shown in the client application. The friendly name would be shown instead of the directory name when one is provided. I have attached a mock-up showing the issue and a UI screen of my envisaged solution.
... View more
A dealer submits an application for a customer who wants a $48,000 pickup truck. The credit profile is acceptable, not exceptional. Debt-to-income sits just above policy. The requested amount pushes past the lender's affordability line.
A traditional origination platform returns a one-word decision; declined. The dealer chooses not to request a decision reassessment; this is a timely process that requires the lender to reevaluate the loan, provide a counteroffer and which might require going back and forth multiple times. The faster way forward is to move to the next lender.
• What if the system suggested automatically a set of counteroffers, displaying a negotiation path to the dealer helping secure the deal efficiently and swiftly? • What if a different rate program lowered the payment? • What if a longer term, or a slightly higher downpayment, changed the risk profile? • What if another vehicle on the lot met the same need, within policy?
The problem may have never been the customer, the real problem is the decisioning process. Not every customer has the perfect risk profile. Loans, when priced and structured correctly, remain profitable despite a riskier customer profile.
Credit Origination Challenges in Automotive Lending
Auto finance isn't a single yes/no credit call. It is several decisions happening at once. An auto loan application sits at the intersection of all of those: Credit bureau information, internal behavioral score, vehicle value, loan-to-value, affordability, term, promotions, dealer programs, portfolio appetite, fraud pattern identification.
The difficult part in auto lending is never whether a customer qualifies, it is about working out all those decision together in real-time to identify how the customer qualifies, while balancing risk, profitability, adaptability to changing market and price conditions and the little time a dealer is willing to wait.
Most origination systems still collapse that whole picture into three outcomes: approve, refer, decline. Everything a declined or referred application could have become can go unexamined; a different structure, a smaller amount, or even a different vehicle.
A referred application, for example, may simply need income verification, yet without real-time income estimation through analytical models or API calls to verification sources, the customer waits while a person resolves the case. Every point of friction adds delay that the customer feels. A counteroffer that needs to be re-keyed manually may mean the structure that could have saved the deal arrives minutes too late, turning an otherwise viable opportunity into a lost one.
With every decline and with a high number of stipulations or referrals, the applications are lost, the booking rate drops, and the dealer routes them and future ones to a faster lender. Key Success Factors: speed, fast data resolution, automated deal structuring, policy controls and complete auditability
How SAS Addresses Those Challenges
Once a decline stops being the default, there are three ways to still get to “yes”: price the risk instead of rejecting it, offer more than one path to approval, and, when nothing else fits, point to a different vehicle entirely.
SAS helps automotive lenders design their credit origination strategies while considering 4 important aspects:
1. One Real-Time Decision Context, Not Six Disconnected Checks
SAS brings different checks into a single real-time view:
Credit profile - Bureau data and internal scoring. The traditional starting point: what the bureau says about the applicant, combined with whatever the lender already knows internally, to establish where this application sits from a pure creditworthiness standpoint.
Affordability - Income verification and debt capacity evaluation. Not just "can they qualify" but "can they actually carry this payment." Income data (verified as fast as it can be resolved) determines whether the requested structure is sustainable for the customer, not just approvable on paper.
Identity & risk - Application fraud. Real-time entity resolution, synthetic-identity checks, and behavioral scoring catching identity theft, fabricated identities, and coordinated fraud rings before they ever reach underwriting, without slowing down legitimate applicants.
Collateral fit - Loan-to-vehicle value. How much is being financed relative to what the vehicle is actually worth. This is the collateral side of risk; a strong credit profile can still be a bad deal if the loan-to-value is upside down from day one.
Customer Context - Existing relationship. Whether this applicant already has a history with the lender, such as other accounts, payment behavior and tenure, that should reasonably factor into the decision rather than treating every application as a first-time stranger.
Eligible programs - Promotions & pricing. Dealer incentives, manufacturer subsidies, and lender promotional rates the applicant might actually qualify for checked in real-time so a better-priced structure isn't missed just because no one thought to ask.
In SAS, together, these six run as one evaluation rather than six separate lookups which is what makes it possible to go from "does this person qualify" to "what's the best way to structure this deal for this person to qualify”.
2. One Applicant, Several Viable Deals
Instead of holding rigid thresholds at the policy line, SAS’s decisioning engine enables risk-based pricing which lets the lender adjust the rate, the term, or the conditions of the deal itself. Compensating factors get weighed in real-time rather than triggering an automatic no. An applicant on the edge of policy is no longer rejected and the decision becomes a pricing question.
SAS evaluates combinations of APR, down payment, term, promotions, and vehicle value together and returns several offers a customer could actually accept such as:
OFFER 1
OFFER 2
OFFER 3
OFFER 4
Lowest payment
Extended term structured to bring the monthly payment under the customer's stated budget.
Lowest APR
Standard term at the best available rate for this risk tier.
Lower-risk structure
A higher down payment that shifts loan-to-value into a stronger risk position.
Promotional financing
An active dealer or manufacturer program applied where the customer qualifies.
Offers are then ranked by likelihood of acceptance and by the lender's own business objectives so the dealer isn't handed four options to sort through, but one clear best path, with alternatives ready if the customer wants to negotiate.
Real-Time Decisioning, Several Viable Deals
3. In Some Cases The Vehicle Is The Answer
In some cases, no financing structure fits the requested vehicle or counteroffers have required a higher down payment which the customer cannot afford. The strongest move isn't a decline, it may be a different vehicle.
When a requested vehicle can't be financed within the customer's affordable payment and available down payment, the engine establishes the maximum payment, loan amount, down payment, and LTV/policy limits, then queries the dealer's inventory using rules, clustering, similarity matching, or scoring/optimization across factors like type, make, model, trim, price, mileage, and features to find and rank vehicles that actually fit. The result is a short list of ranked, financeable alternatives paired with new finance offers turning what would have been a decline into a retained customer, a supported dealer, and a booked loan.
Vehicle Matching
This is the quiet shift underneath everything else: origination stops being a credit assessment and becomes deal structuring. The customer isn't lost. The dealer isn't frustrated. The lender books a deal it would otherwise have handed to a competitor.
4. A Real-time Process Built To Move as Fast as The Market Does
Rates, vehicle values, and promotions shift constantly. The strategy layer has to keep pace without waiting on an IT release.
SAS connects directly to the lender's live data sources, bureau feeds, pricing tables, inventory, promotional programs, so a rule or a rate change reflects the current state of the market the moment it's saved, not after the next batch job or nightly refresh. Business teams update pricing tables, rules, segmentation, and score cutoffs themselves without filing a ticket and waiting on a development cycle to see it live.
The same speed applies to the analytics underneath the rules. A new or retrained credit or fraud model, behavioral model, or income estimator can be deployed with a single click rather than a multi-week release process. This means a model built in response to a shift in delinquency patterns can be in production before that shift becomes a loss. And because deployment, monitoring, and champion/challenger testing all happen inside the same platform, a new model doesn't replace the old one blind: it runs alongside it as a challenger model, proves itself against live traffic, and earns its way into the primary decision path.
The result is a strategy layer that moves at the speed of the market instead of the speed of IT rules that update as policy changes, models that deploy as fast as they're validated, and a decisioning platform that's never more than a click behind the conditions it's supposed to be pricing for.
SAS Intelligent Decisioning: The Intelligence Behind Every Lending Decision
SAS uses a range of capabilities to achieve an optimized real-time credit origination process. Among those are business rules, predictive models, REST API integrations, data queries, treatments, champion/challenger testing, and real-time execution that work together seamlessly within a single decision flow.
Customer data is enriched through open banking and credit bureau integrations. Models, rules and data drive risk and fraud assessments. Multiple financing offers are dynamically generated and optimized. The platform goes beyond simple approval or decline decisions by proposing intelligent counteroffers and even scanning the dealer’s inventory and recommending alternative vehicles when affordability constraints arise.
Most importantly, strategies can be adapted without redeployment, models and decisions are governed, versioned and explainable and business users can rapidly test, deploy, and monitor decision strategies in production.
Illustration of a Loan Origination Process with SAS Intelligent Decisioning
A different question to ask at origination
Not: "Should we approve this applicant?"
But: "What combination of vehicle, amount, term, pricing, and down payment lets us book this deal profitably, within our risk discipline?"
Real-time data, analytics, AI, and enterprise decisioning let SAS answer that question in seconds helping lenders book more business, strengthen dealer relationships, and improve portfolio performance, one structured deal at a time.
Recommended Resources:
SAS for Risk Modeling & Decisioning | SAS
SAS Credit Customer Management | SAS
SAS Credit Origination | SAS
For more information, please contact Carla Boustany ([email protected])
... View more
Team Name Residual Intelligence Track Banking Use Case Develop a SAS-based statistical and machine learning vehicle valuation solution that accurately estimates current and future vehicle values where third-party data is unavailable, improving valuation coverage, risk measurement, financial reporting, and operational decision-making across the Motor Finance portfolio. Technology SAS! Region UK Team lead Ben Messam @benmessam Team members Will Dickson @Will_Dickson Krishna Simhadri @KrishnaSimhadri Social media handles Is your team interested in participating in an interview? Y Optional: Expand on your technology expertise Combined decades of experience in SAS-based credit risk model development, supported by expertise in Python, machine learning, IFRS 9 modelling, model governance, automation, and responsible AI, enabling the delivery of robust and business-focused analytical solutions.
... View more