SAS has officially released a VS Code SAS programming code extension. The extension is available on SAS’ Visual Studio Marketplace, and we’ve also created the sas-vscode-extension repository on sassoftware GitHub. The extension is available for use on SAS Viya and also works with specific configurations of SAS 9.
In 2019 a survey on Stack Overflow listed VS Code as the IDE of choice for 50% of the developers surveyed. That number jumped to 71% in 2021. Moral of the story: VS Code is popular in the developer community and is still growing in adoption. Rather than asking developers to log into, and code in, the SAS UI, we’ve developed the VS Code SAS Extension. The tool offers users an integration point for adding SAS programs and code into their work, without having to switch applications. The tool also offers the ability to connect directly to SAS Viya and run code.
Repeat for those who skipped TL;DR: The extension is available on SAS’ Visual Studio Marketplace, and we’ve also created the sas-vscode-extension repository on sassoftware GitHub. The extension is available for use on SAS Viya only.
The extension offers the following features.
|SAS Syntax Highlighting||Color Themes||Code Completion|
|Pop-up Syntax Help||Snippets||Code Folding and Code Outline|
|Configuring the SAS Extension||Running SAS Code||VS Code for the web compatible|
|VS Code Notebooks||Data Viewer|
The list above is not exhaustive and we're just at the beginning. We plan on adding more features over time. I will not go through the specific features in this article. Rather, I’ll offer some background on why SAS created the tool, how it can benefit users, run through a short use case, and challenge you to be creative in using the extension.
The extension is open for use by anyone using VS Code; however, there is certainly a user base that would be more apt to adopt it. We’re a data-driven company. Numbers don’t lie. Based on the Stack Overflow survey results, it’s clear developers do their work in VS Code. We need to meet these users where they are. Consider the scenario below and see how the extension benefits developers.
Let’s also consider other potential users.
We’re not suggesting SAS programmers alter what they do in SAS Studio, in any way. The VS Code extension offers an alternative, if the need arises, to be flexible with a new integration point.
Additionally, students, companies that support the use of VS Code in their tech stack, and Microsoft’s Azure DevOps customer base will have the opportunity to make use of the SAS extension.
While the initial contribution of core functionality is by SAS R&D, we expect and encourage continued contributions by SAS developers, partners, and consultants. In fact, we’ve already seen issues logged and conversations occur in the Marketplace and on GitHub.
SAS has a commitment to support the community contribution effort through code reviews and assistance with critical bugs. We also expect this to be a popular topic in the SAS Support Community. A conversation on this subject in the Developers Community has over 6k views and comments from several users wanting to contribute.
In the following video, I cover extension installation, configuration, and highlight multiple features.
Let's take a look at installation and functionality using this simple use case.
Two ways to accomplish this:
This setting enables things like SAS programming color coding, type ahead, the 'SAS running man' icon, and other SAS-specific features.
data race; pr =probnorm(-15/sqrt(325)); run; proc print data=race; var pr; run;
For more information about the authentication process, please see the blog post Authentication to SAS Viya: a couple of approaches.
You can create a Profile with connection information to SAS Viya. You have the ability to create multiple profiles to connect to different SAS Viya environments. Profile configuration depends on your SAS Viya version.
Connections to SAS Viya use an authorization code and the pre-loaded vscode client id.
Connections to SAS Viya use an authorization code and a client id created by a SAS Admin
The extension uses the current profile to connect to SAS Viya. On the initial connection to SAS in a VS Code session follow these steps:
See the Running SAS Code section of the README for more details.
Note: subsequent calls in the same VS Code session will connect directly to SAS Viya. You do not need to repeat the authorization code steps.
Want to become a star? Ready to impress everyone? Here’s where you can help. You'll hear plenty from SAS about the new VS Code extension; however, oftentimes our users come up with the best ideas for use of our software and tools. If you have a use case that’s more interesting than what’s outlined above (a simple code example, only using SAS), we’d love to hear about and feature it.
Is this project complete? Absolutely not. We're adding additional functionality and making improvements based on user feedback. We've also processed multiple pull requests on GitHub incorporating changes from the field. We want to continue providing proper functionality, responding to user concerns, and facilitating the use of our new extension. Try it out and tell us what you think.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.