Please note that this extension may be downloaded but it will only operate fully for participants in the SAS private preview who have a signed agreement with SAS.
The SAS Viya Copilot Extension for Visual Studio Code is a great tool to enhance your productivity as you program in SAS. SAS Viya Copilot uses Generative Artificial Intelligence (GenAI) to add comments to a block of SAS code, write an explanation of a block of SAS code, and generate SAS code based on a block of comments in a SAS program.
We are presently undergoing internal testing. If you encounter any bugs or have suggestions, please report as issues.
Please contact [email protected] if you have any questions.
For the richest experience, including syntax highlighting, code completion, and many other features, use this extension along with the official SAS Extension
An API key is required to use this extension. Please contact [email protected] if you are having trouble finding your API key.
When you run any of the commands (Add comments, Explain, or Generate code) for the first time, you are prompted to enter your API key.
Your API key can also be entered through the SAS Viya Copilot extension settings.
Note: After you enter your API key the first time, the key is saved and used for additional commands until you explicitly clear the key. To clear the API key, press Ctrl (or Command for Mac users) + Shift + P, and run the SAS Copilot: Clear API key command.
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.