This SAS KB article explains how to install “Visual Studio Code” on your PC, add the “SAS Extension for Visual Studio Code”, and add “SAS Viya Copilot”.
This article also explains how to set up connections to a SAS Viya server, a SAS® 9.4 server, and a local PC installation.
Documentation
For detailed information, see the SAS Extensions for Visual Studio Code documentation.
Download and Installation
Download and Install the “Visual Studio Code” App
See the following resource to access the downloads: https://code.visualstudio.com/download.

Add “SAS Extension for Visual Studio”
Complete the following steps to add the SAS Extension for Visual Studio:
- Start Visual Studio Code.
- Click the Extensions button in the left panel.
- Search for SAS Extension.
- Install the Official SAS Language Extension.
- Click Install:

The SAS icon is displayed in the left panel:

Add “SAS Viya Copilot”
Note: SAS Viya Copilot works with only SAS® Viya® 2025.12 and later.
Complete the following steps to add the SAS Viya Copilot:
- Start Visual Studio Code.
- Click the Extensions button in the left panel.
- Search for SAS Viya Copilot.
- Click Install:

The SAS icon is displayed in the left panel:

Add the Windows System Environment Variable to Connect to SAS Viya
Complete the following steps to add the Windows System environment variable to connect to SAS Viya:
For more information, see the Frequently Asked Questions section in the SAS Extension for Visual Studio Code documentation.
- Set the NODE_TLS_REJECT_UNAUTHORIZED environment variable to 0 to bypass the certificate check.
- Shut down all VS Code instances.
- Then, restart the application with the updated environment variable.
Note: If you are connecting to a remote workspace, set the environment variable on the remote system and terminate all VS Code server processes. (For example, run ps -aux | grep vscode-server on the remote Linux machine to see the processes.)
Then, complete the following steps:
- Search for Environment Variables.
- Start Edit the system environment variables:

- Click Environment Variables:

- In the System variables section, click New:

- Enter the name of the new Variable name: NODE_TLS_REJECT_UNAUTHORIZED
- Then, specify 0 for the Variable value:

The new environment variable is defined.
- Click OK to leave the Environment Variables window:

- To make the environment variable effective in Visual Studio Code, close Visual Studio Code and start it again.
Connections to SAS Environments
Connect to a SAS Viya Server
Complete these steps to connect to a SAS Viya Server:
- Start Visual Studio Code.
- Press the F1 key.
- In the top-middle section of the screen, actions are displayed.
- Select SAS: Add New Connection Profile:
- Add connections to the SAS environments:

- Enter a connection name and press the Enter key:

- Select the Connection Type:

- Enter the base SAS Viya Server URL and press the Enter key.
For example, you would enter something similar to the following:
https://enter.the.base.URL.to.your.VIYA.server/
Do not include SASStudio or SASLogon/login at the end as shown here: https://enter.the.base.URL.to.your.VIYA.server/SASStudio

- The SAS Compute Context field is pre-filled. Press the Enter key:

- Do NOT enter a Client-ID. Press the Enter key:

The connection is defined and active.
In the bottom left corner of the window, the active connection profile is displayed:

Log On to a SAS Viya Server
Complete these steps to log on to a SAS Viya Server:
- Click the SAS icon in the left panel.
- Click Sign in.
- Click Allow:

- Click Open:

The “Authorization Code” website for that server opens in a browser.
Note: You might need to log on to the server with your user-ID and password first.
- Highlight (that is, select) the Authorization Code and press CTRL-C to copy it:

- Paste the authorization code in the required field in Visual Studio Code. Then, press the Enter key:


The SAS Environment populates in the left panel:

Connect to a SAS 9.4 Server
Complete these steps to connect to a SAS 9.4 Server:
- Start Visual Studio Code.
- Press the F1 key.
- In the top-middle section of the screen, actions are displayed.
- Select SAS: Add New Connection Profile.
- Add connections to the SAS environments:

- Enter a name for the connection. Then, press the Enter key:

- Select SAS 9.4 (remote – IOM) as the Connection Type:

- Provide the Server-Name of the SAS 9.4 Server (as in the SAS® Enterprise Guide® Connection). Then, press the Enter key:

- Press the Enter key to accept the default port:

- Enter the user name that you want to use to connect to the SAS 9.4 Server. Then, press the Enter key:

The active connection is displayed in the bottom left corner of the Visual Studio Code window:

Log On to a SAS 9.4 Server
Complete the following steps to connect to the SAS 9.4 Server:
- Click the SAS Extension icon in the left panel.
- Enter the user's password.
- Press the Enter key:

The SAS environment populates in the left panel:

Connect to a Local PC SAS Installation
- Start Visual Studio Code.
- Press the F1 key.
- In the top-middle section of the screen, actions are displayed.
- Select SAS: Add New Connection Profile.
- Add connections to the SAS environments.

- Enter a name for the connection, Then, press the Enter key.

- Select SAS 9.4 (local) as the Connection Type.

Switch Server Connections
- Click the current server connection in the bottom left section of the Visual Studio Code window.
- In the top-middle section, a list of available connections is displayed.
- Select the connection that you want to use.

Delete a Server Connection
- Press the F1 key.
- Select SAS: Delete Connection Profile.

- Select the connection profile that you want to delete:
