SAS Extension for Visual Studio Code
Welcome to the SAS Extension for Visual Studio Code! This extension provides support for the SAS language, including the following features:
Install latest VS Code (version 1.82 at minimum). To install the SAS extension, open the Extensions view by clicking the Extensions icon in the Activity Bar on the left side of the Visual Studio Code window. Search for the 'Official' SAS extension, and click the Install button. Once the installation is complete, the Install button changes to the Manage button.
SAS Syntax Highlighting
The SAS extension highlights these syntax elements in your program, just as they would appear in a SAS editor:
You can choose among three SAS-related color themes that control the color of the application and syntax elements. The SAS Light, SAS Dark and SAS High Contrast options mirror the themes available in SAS Studio.
To specify the color theme:
The SAS extension includes automatic code completion and pop-up syntax help for SAS keywords. The autocomplete, or code completion, feature in the code editor can predict the next word that you want to enter in your SAS program. See code completion in action below.
To use the autocomplete feature:
Pop-up Syntax Help
The syntax help gets you started with a hint about the syntax or a brief description of the keyword. You can get additional help by clicking the links in the syntax help window.
To view the syntax help:
In the following example, the help panel displays syntax help for the DATA= option in the PROC PRINT statement.
Tip: Click the links in the syntax help window to navigate to the SAS online help.
Snippets are lines of commonly used code or text that you can insert into your program. The SAS extension includes snippets for SAS functions and procedures to facilitate writing your SAS programs.
To access the list of snippets for a function or procedure:
Code Folding and Code Outline
Regions of code are identified in your SAS program as blocks of code that can be collapsed and expanded. You can also view an outline of your program that identifies DATA steps, procedures, macro sections, and user-defined regions of code.
Tip: You can define a custom region by adding
Configuring the SAS Extension
Before running SAS code, you must configure the SAS extension to access a SAS 9.4 (remote or local) or Viya server. You must license SAS 9.4 or Viya to run SAS code.
Profiles are easy ways to switch between multiple SAS deployments. For Viya connections, multiple Viya profiles can be used to switch between compute contexts. There is no limit to the amount of profiles that can be stored.
Profiles will be stored into the VSCode settings.json file, and can be modified by hand, if needed.
The following commands are supported for profiles:
Details on creating and managing profiles is available on the Connect and Run page.
Running SAS Code
After configuring the SAS extension for your SAS environment, run your SAS program and view the log and results.
Details on running code is available on the Connect and Run page.
Accessing SAS Content
After configuring the SAS extension for a SAS Viya environment, you will be able to access SAS Content.
To access SAS Content:
Accessing Libraries and Tables
After configuring the SAS extension for a SAS Viya environment, you will be able to access your connected libraries.
You can use the libraries pane to delete a table, drag and drop tables into your SAS program code, or view a sample of the table data.
Notebook is an interactive experience with Markdown, executable code snippets and corresponding rich outputs organized in cells.
Its possible to customize when the SAS log gets shown in the bottom panel by using the following extension settings. These settings will apply to all connection profiles: | Name | Description | Additional Notes | | ---------------------------------| --------------------------------------- | ----------------------------- | | SAS.log.showOnExecutionStart | Show SAS log on start of execution | default: true | | SAS.log.showOnExecutionFinish| Show SAS log on end of execution | default: true |
To see an example, please refer to the Viya4 example profile.
Ask, Find, and Share on the VS Code SAS Extension on the SAS Programmers Community site.
SAS Programming Documentation
Please check the FAQ page for some common questions.
See the SUPPORT.md file for information on how to open an issue against this repository.
Contributing to the SAS Extension
We welcome your contributions! Please read CONTRIBUTING.md for details on how to submit contributions to this project.
This project is subject to the Apache License Version 2.0, a copy of which is included as LICENSE