SAS 9.4 (local - stdio) Connection Profile
The SAS 9.4 (local - stdio) connection type allows you to run SAS locally on your machine using standard input/output pipes (stdin/stdout/stderr) instead of SSH. This connection type provides the same interactive SAS session semantics as the SSH connection type but without network overhead.
When to Use Stdio
Use the stdio connection type when:
- SAS is installed locally on the same machine as VS Code
- You want to avoid SSH connection overhead
- You're working on a single-user development machine
Requirements
- SAS 9.4 must be installed locally on your machine (or inside Docker container)
- The SAS executable must be accessible via a fully qualified path
- Your operating system must be Linux (other OS were not tested)
Positron and Posit Workbench
In Positron, when SAS is installed locally, the extension adds a local stdio profile once, so SAS appears in the console's interpreter list without any setup. It looks for the SAS launcher in these places, in order, and uses the first executable one:
- The paths in the
SAS.localSasPathssetting, if any /opt/sas/viya/home/SASFoundation/sas(SAS Analytics Pro images)- Common SAS 9.4 Foundation locations:
/opt/sas/SASHome/SASFoundation/9.4/bin/sas_u8/usr/local/SASHome/SASFoundation/9.4/bin/sas_u8/opt/sasinside/SASHome/SASFoundation/9.4/bin/sas_u8/opt/SASHome/SASFoundation/9.4/bin/sas_u8
sasonPATH
For SAS 9.4 the extension uses bin/sas_u8, the launcher for the UTF-8 (Unicode) SAS session, not the sas script in SASFoundation/9.4. The extension reads SAS output as UTF-8, so a SAS session with another encoding can show garbled non-ASCII text. When you list a SAS 9.4 launcher in SAS.localSasPaths, use bin/sas_u8 as well.
If SAS is installed elsewhere, list its launcher in SAS.localSasPaths (a machine setting, fully qualified paths):
{
"SAS.localSasPaths": ["/data/SASHome/SASFoundation/9.4/bin/sas_u8"]
}
The profile is not added if a stdio profile already exists. It becomes the active profile only if none is set. If you delete it, it is not added again.
If the extension cannot save the profile to settings.json, for example because Posit Workbench writes settings.json at the same moment when a session starts, it tries again several times over about 15 seconds. If every attempt fails, a warning offers Retry: if settings.json shows unsaved changes, save or revert it first. A profile that could not be saved is added again at the next start. Version 0.6.2 or later is needed for this; with earlier versions, the profile could be lost on the first start in a SAS Analytics Pro image.
In a Posit Workbench session started from a SAS Analytics Pro image, Workbench licenses SAS for the session through the SASV9_OPTIONS environment variable. The stdio session inherits it, so no license options are needed in the profile.
In Positron, a stdio session supports the SAS console, the Viewer and Plots panes, browsing libraries in the Connections pane, and the Data Explorer. The SAS Content and SAS Server views are not available. Use Positron's Explorer for local files.
Profile Anatomy
A SAS 9.4 (local - stdio) connection profile includes the following parameters:
"connectionType": "stdio"
| Name | Description | Additional Notes |
|---|---|---|
saspath | Path to local SAS Executable | Must be a fully qualified path on your local machine to SAS. |
Example Configuration
To create a stdio connection profile, add an entry to your VS Code settings:
{
"SAS.connectionProfiles": {
"profiles": {
"local_sas": {
"connectionType": "stdio",
"saspath": "/usr/local/SASHome/SASFoundation/9.4/bin/sas_u8"
}
},
"activeProfile": "local_sas"
}
}
With Additional SAS Options
You can include SAS startup options in your profile:
{
"SAS.connectionProfiles": {
"profiles": {
"local_sas_custom": {
"connectionType": "stdio",
"saspath": "/usr/local/SASHome/SASFoundation/9.4/bin/sas_u8",
"sasOptions": ["-memsize", "2G", "-work", "/tmp/saswork"]
}
},
"activeProfile": "local_sas_custom"
}
}
With AutoExec
You can configure AutoExec lines to run automatically when the session starts. They run once, right after SAS starts and before any code you submit. See SAS Autoexec Settings:
{
"SAS.connectionProfiles": {
"profiles": {
"local_sas_autoexec": {
"connectionType": "stdio",
"saspath": "/usr/local/SASHome/SASFoundation/9.4/bin/sas_u8",
"autoExec": [
{
"type": "line",
"line": "options pagesize=max;"
},
{
"type": "file",
"filePath": "/home/user/my_autoexec.sas"
}
]
}
},
"activeProfile": "local_sas_autoexec"
}
}
How It Works
The stdio connection type:
- Spawns a local SAS process
- Opens stdin, stdout, and stderr pipes to communicate with SAS
- Maintains a persistent SAS session across multiple code submissions
- Streams logs in real-time. Outputs are directly opened from filesystem
This provides identical behavior to the SSH connection type, but without requiring a remote server or SSH authentication.
Interrupting Running Code
A stdio session cannot cancel code that is running. In Positron, when you interrupt the console, SAS keeps running the code and the console stays busy until it finishes. A message offers to restart the session instead, which ends the SAS process. Restarting loses the session's WORK tables, macro variables, and librefs.
Common SAS Executable Paths
The location of the SAS executable varies by installation. Common paths include:
Linux/Unix
/opt/sasinside/SASHome/SASFoundation/9.4/bin/sas_u8
/usr/local/SASHome/SASFoundation/9.4/bin/sas_u8
/opt/sas/viya/home/SASFoundation/sas # SAS Analytics Pro
Check with your SAS administrator or installation documentation for the exact path on your system.
Comparison with SSH Connection
| Feature | SSH Connection | Stdio Connection |
|---|---|---|
| Session persistence | ✅ | ✅ |
| Incremental code execution | ✅ | ✅ |
| Real-time log streaming | ✅ | ✅ |
| ODS output | ✅ | ✅ |
| Requires remote server | ✅ | ❌ |
| Requires authentication | ✅ | ❌ |
| Network overhead | ✅ | ❌ |
| Local SAS installation | ❌ | ✅ |
Troubleshooting
Connection Fails to Start
If the SAS process fails to start, verify:
- The
saspathis correct and points to a valid SAS executable - You have execute permissions on the SAS executable
- SAS is properly licensed on your local machine
Session Behaves Unexpectedly
- Check that your SAS options are valid
- Review the SAS log for error messages
- Ensure your WORK directory has sufficient space
- Verify that AutoExec files (if specified) are accessible and valid
See Also
The stdio connection type was contributed upstream by Andreas Menrath in sassoftware/vscode-sas-extension#1771.