Please note that this extension may be downloaded but it will only operate fully for participants who have a signed agreement with SAS and have a Viya 4 license.
The SAS Viya Copilot extension for Visual Studio Code is a tool that enhances your productivity as you program in SAS. SAS Viya Copilot uses Generative Artificial Intelligence (GenAI) to add comments to SAS code, write an explanation for existing SAS code, and generate SAS code based on instructions in comments in a SAS program.
If you encounter any bugs or have any suggestions or questions, please report as issues.
- VSCode version ≥ 1.89
- official SAS Extension version ≥ 1.14.0
- A SAS Viya 4 deployment (2025.12 or later) for Copilot access keys - SAS Viya, SAS Viya Advanced, SAS Viya Enterprise, SAS Viya Programming
If you have already setup your Viya account in the official SAS Extension, you may skip this step.
- Go to your official SAS Extension settings (right click the extension, select "Settings")
- Add a Connection Profile to your Viya (or edit the settings.json to add a different profile if you have multiple accounts).
For more information on this process, please refer to the official SAS Extension's documentation
NOTE: This step must be done by a SAS Administrator!
In order to authorize your account to use the Viya Copilot extension, a SAS Administrator must add you to the "GenAI VSCode" users group. This can be done using the SAS Environment Manager tool.
- Login to Viya, assume Administrator privileges.
- Go to the Applications Menu on the left hand side, select "Manage Environment" under Administration.
- On the Environment Manager screen, select "Users and Groups".
- Search for "GenAI VSCode Users", then click the pencil (edit) icon under "Members".
- Search for and add the desired user(s) or group(s). Click Save.
You should now be authorized to use the extension!
The SAS Viya Copilot extension includes commands to generate code, add comments, and explain code.
To generate SAS code:
- Open a SAS program file, or create a new file using SAS language mode.
- Position the cursor in a SAS comment statement or select a comment block. SAS comments start with
/*and end with*/. - Click Generate code. The available generated code options will be displayed as gray inline code. Users will need to choose and select the desired code from these options.
Note: To generate code from a longer, multi-line prompt, highlight entire prompt and then select "Generate Code"
To add comments to an existing block of SAS code:
- Open a SAS program file, or create a new file using SAS language mode.
- Select a block of SAS code and click Add comments. The selected code block is replaced with a block of commented code.
To generate an explanation of a block of SAS code:
- Open a SAS program file, or create a new file using SAS language mode.
- Select a block of SAS code and click Explain.
The explanation of the code block is displayed in the SAS Viya Copilot conversation pane on the left side of the application window.
You can run any of the SAS Viya Copilot commands by right-clicking a selected block of code or comments and selecting a command from the context menu.
To run SAS Viya Copilot commands with the Command Palette:
- Select a block of code or comments.
- Select View > Command Palette or press Ctrl (or Command for Mac users) + Shift + P to open the Command Palette.
- Enter SAS Copilot in the search box to display the available commands and click the command that you want to use.





