The VS Code with the SAS extension is becoming a top tier programming client for SAS users. It has many of the features that programmers expect, such as syntax suggestions, built-in syntax help and doc, and the ability to connect to any SAS environment. New SAS learners who rely on SAS OnDemand for Academics had been left out of this experience, but no more! With the latest updates to the SAS extension, you can connect VS Code to your account in SAS OnDemand for Academics (sometimes-but-not-officially called "SODA"). Once connected, you can run code and see your results within VS Code -- no need to log in via a browser.
VS Code with the SAS extension, connected to SODA
How to connect VS Code to SODA
Before we get into it, I'll admit that this connection type is available only on Windows. Also (this is an update after some readers tested), the method requires that you have at least another SAS application installed: SAS Enterprise Guide, SAS for Windows, or SAS Add-In for Microsoft Office. (The component that supports TRIPLEDES encryption is needed and is not part of the downloadable package I reference below.) Note that SAS OnDemand for Academics users do have a path to get SAS Enterprise Guide if they are students enrolled in a course that uses it.
If you're running VS Code on a Mac or other device type, this connection won't work. It relies on the Windows-only "SAS Integration Technologies client", working similar to SAS Enterprise Guide. Mac users: I'm sorry. (You can still use the SAS extension to edit and manage your SAS programs, and you can connect to SAS Viya environments, but you won't be able to connect to SAS 9.4 environments with this method.)
This connection is made possible by two innovations:
The addition of SAS 9.4 (Remote - IOM) as connection option in the VS Code extension
The already-documented connection information for open-source clients (like SASPy) to connect to SAS OnDemand for Academics
Setting up the prereqs
Before you get started, you will need these prerequisites (all free):
An account to log into SAS OnDemand for Academics. This is free for any learner and for non-commercial uses.
VS Code installed on your Windows device. Add the SAS Extension for Visual Studio Code while you're at it.
The SAS Integration Technologies Client for Windows -- installed. This is already installed with any local SAS applications like SAS 9.4 for Windows or SAS Enterprise Guide. It's also available as a free download from support.sas.com. (Be sure to get the most recent version.)
To define your VS Code/SAS profile, you will need to gather the following information from your SODA account:
the "home region" of your SODA connection. This is displayed at the top of the Welcome page after you sign in.
your user ID. This is available in the dropdown menu next to your profile name
your SODA password. This is also your SAS Profile password.
For example, in this screenshot you can see that my home region is "United States 1" and that my user ID is the value beginning with "u3":
Welcome screen with home region, profile details
Finding your server name by host region
SAS OnDemand for Academics is a large-scale SAS environment that has hundreds of thousands of active users around the globe. The environment is divided into multiple regions with multiple server hosts. Your account is accessible only from the servers in your assigned region, so you need to match your home region with the server name in order to sign in with the SAS extension.
The server/region mapping is defined in the instructions for open-source connections. I've added the current values here for reference, but note that these are subject to change.
US Home Region 1: odaws01-usw2.oda.sas.com
US Home Region 2: odaws01-usw2-2.oda.sas.com
European Home Region 1: odaws01-euw1.oda.sas.com
Asia Pacific Home Region 1: odaws01-apse1.oda.sas.com
Asia Pacific Home Region 2: odaws01-apse1-2.oda.sas.com
Define your profile in the SAS extension
With all of the information gathered, we're now ready to add a SODA profile to the SAS extension in VS Code. Complete these steps in your VS Code session.
Press Ctrl+Shift+P or F1 to show available commands, and select "SAS: Add New Connection Profile".
Assign a name for this connection profile. I've used "SODA" here.
Select the SAS 9.4 (remote - IOM) connection type.
Enter the server name that is associated with your host region. Then confirm the Port number (always 8591 for this environment).
Enter your SAS OnDemand for Academics username.
That's it! Once the profile is defined it should appear as your active SAS profile as indicated in the status area in the bottom of your VS Code window.
Open a SAS program file, or create a New SAS file with VS Code, then click the "running person" (or press F3) to submit it.
The first time that you run a program, you'll be prompted for your SAS OnDemand for Academics password. Type it in the field and press Enter, and your program will run in your SODA account!
Because your program is running in your SAS OnDemand for Academics account, your code can reference any data or files that you have access to in that environment. As your program completes, you'll see the SAS Log in the output area of VS Code, and any ODS HTML results will automatically display in a new Results window.
Anatomy of your SAS environment in VS Code
Limitations
At this time, the SAS 9.4 - Remote IOM connection does not support navigation for SAS libraries, viewing data sets with a built-in viewer, or remote file access/management. These features are supported for the SAS Viya connection type, and they are actively being worked on for SAS 9.4 - Remote IOM. Coming soon!
... View more