BookmarkSubscribeRSS Feed
SB711
SAS Employee

AI remains the biggest buzz in 2026 and there’s no way we can turn our backs on it. The best way to tackle AI is to adapt to AI and make it a part of our daily corporate tasks. Right from emails to documentation to even SAS Programming, I believe that AI is here as an assistant, augmenter and accelerator to improve the way we work.

 

As a part of my trainer role, I work with many young students who have knowledge of some programming language which they learnt in their schools. I also work with experienced programmers who’ve been coding for years. Copilot is going to change / already changing the way programmers do coding.

 

Disclaimer: Though I have used Copilot as an example in this article, please feel free to read it as ChatGPT, Claude or any other AI system.

 

Based on my experience of coding and working with coders so far, here are my 2 cents on what works and what doesn’t when you use Copilot to help you with SAS Programming especially when you’re a new SAS programmer who’ve less than 1 year of coding knowledge.

 

What Works

 

Learning SAS Syntax

SAS Programming has a very rich set of functions, formats, procedures and statements. A new programmer might feel like drowning in the jargon ocean. Copilot is a great support in this scenario.

Understanding syntax becomes easier and new programmers can focus on building logic than memorizing syntax!

 

Example of Copilot prompt and partial results:

 

SB711_9-1778467899457.png

 

Taking over coding done by ex-colleague

Understanding coding done by someone else can be mindboggling. Copilot to the rescue! It can be used to simplify and understand existing coding which otherwise will take long time if you’ve to do it all by yourself.

 

Example of Copilot prompt and partial results:

SB711_10-1778468023725.png

 

SB711_11-1778468060167.png

 

Getting your problem statement converted into SAS Code

 

When the timelines are tight and you’ve to churn out quick reports as a new programmer, things can get overwhelming. Copilot works excellently in such scenarios in my experience.

 

Example of Copilot prompt and partial results:

 

SB711_12-1778468123500.pngSB711_13-1778468131684.png

 

Comparing this vs. that

 

Many times, I have personally used Copilot to understand differences between similar-natured functions or concepts. Examples will be – Scan vs Substr, Compute Server vs CAS, Data Step vs. Proc SQL and so on.

Copilot summarizes in bullet points, and you can also save the results as a PDF ready reckoner.

 

Example of Copilot prompt and partial results:

 

SB711_14-1778469064642.png

 

What Doesn’t Work

 

Using Copilot as a SAS Programmer

 

Well, if you think that your entire coding workload can be handled by Copilot, probably you’re on the wrong track. Code generated by Copilot is not guaranteed to be 100% correct whether syntax or logic. Also, it might not be designed for efficiency in performance.

 

So, caution needs to be maintained when it comes to relying on Copilot code. Copy-paste approach is quite dangerous. You still have to thoroughly test and edit the code as necessary to suit your use case.

 

Traditional SAS code vs. CAS-compliant code

 

Copilot is prone to goof up when it comes to generating CAS-compliant code. It doesn’t well-differentiate between SAS library vs. CAS library or single-threaded vs. multi-threaded options unless you specify very very explicitly.

 

Example of Copilot prompt and partial results and what’s potentially wrong with the results:

Prompt:

 

SB711_16-1778469763386.png

Results:

SB711_17-1778469819396.png

 

Copilot suggested the code in PROC FEDSQL instead of a Data Step. Also note that the tables are in the work and pvbase libraries, which are not CAS libraries.

 

Complex Data step programming or Macro coding

 

Copilot is known to struggle with SAS code when it comes to Macro quoting functions or excessive use of Proc SQL where Data step is simpler or vice-versa or assumptions like data is sorted even when it’s not. Copilot also might “hallucinate” and suggest non-existent proc options or CAS actions and so on.

 

We all need to note here that Copilot and other AI systems are updated and refined through successive model releases. This will lead to improvements and refinements in accuracy and consistency of results.

 

Example of Copilot prompt and partial results and what’s potentially wrong with the results:

 

SB711_18-1778469923716.png

 

Copilot is indeed valuable aid for new programmers but only when it’s coupled with programmer’s own intelligence, diligence and evaluation of Copilot-generated SAS code.

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore Now →
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 0 replies
  • 316 views
  • 1 like
  • 1 in conversation