During my recent Ask the Expert webinar (on-demand link) on the SAS Extension for Visual Studio Code (VS Code) one question came up: Can you please share the example settings.json? The answer is of course yes (and if you are only interested in that, skip to the end), but I thought it is a great opportunity to dive deep into it.
If you are looking for a general article on the SAS Extension for VS Code check out this article.
Configurations inside of VS Code are stored in JSON format. And the settings.json is exactly that store, while there is a global setting.json, if you go to one specific Extension you will get to interact with a settings.json that is reduced. JSON So how do we get there? Go to Manga (cogwheel icon) > Settings > Extensions > SAS > Edit in settings.json - or follow this GIF:
That is a fair question, because a lot of the options can be changed through the visual UI that we see just before going to edit the settings.json. And I strongly recommend that you use the visuals for adding settings or profile where you can, as the interfaces are easy to use and have great context information that will help you to better understand the context of each option.
First we will only focus on the attributes that start with SAS, that is because these settings actually come from the SAS Extension. Depending on what other extensions you have installed you might see many additional attributes in there.
Second will split the SAS attributes into two camps:
1. SAS.connectionProfiles
2. The rest of the settings, all of them can be edited through visuals. I will not be explaining these here, because as stated above I think they are well explained in the visual part and I would only be reiterating these explanations here.
This section holds all of your connection profiles to different SAS environment. Here we first see the activeProfile which contains the name of the last selected connection profile. After that we see the profiles, which will contain entries for each profile that you have created. Note that as I write this there is currently four types of profiles available SAS Viya, SAS 9.4 (remote - SSH), SAS 9.4 (remote - IOM) and SAS 9.4 (local) - each of the entries will look slightly different depending on the type.
For creating/updating/deleting profiles I recommend that you use the corresponding commands (SAS: Add New Connection Profile, SAS: Update Connection Profile and SAS: Delete Connection Profile). But if you want to add specifc auto exec code or change SAS options within the context of your profile you are correct in going to the settings.json.
Let's assume we have the following:
{
"SAS.connectionProfiles": {
"activeProfile": "SAS Viya",
"profiles": {
1 "Profile Name": {
2 "connectionType": "",
3 "autoExec": [
4 {
"type": "line",
"line": "%put Hello World;"
},
5 {
"type": "file",
"filePath": "/path/to/local/example.sas"
},
6 ...
],
7 "sasOptions": ["pageSize max", ...]
}
}
}
}
]
}
{
"SAS.connectionProfiles": {
"activeProfile": "SAS Viya",
"profiles": {
"SAS Viya": {
"connectionType": "rest",
"endpoint": "https://sasviyaHostURL",
"context": "SAS Job Execution compute context",
"clientId": "leave empty for the default client (only available on SAS Viya 4)",
"clientSecret": "leave empty for the default client (only available on SAS Viya 4)",
"autoExec": [
{
"type": "line",
"line": "%put Hello World;"
},
{
"type": "file",
"filePath": "/path/to/local/example.sas"
},
...
],
"sasOptions": ["pageSize max", ...]
},
"SAS 9.4 IOM": {
"connectionType": "iom",
"host": "sasServerAdress",
"port": 8591,
"username": "yourSASUsername",
"sasOptions": [],
"autoExec": []
},
"SAS 9.4 Local": {
"connectionType": "com",
"host": "localhost",
"sasOptions": [],
"autoExec": []
},
"SAS 9.4 SSH": {
"connectionType": "ssh",
"host": "sasServerAdress",
"saspath": "/path/to/sas/executable",
"username": "yourSASUsername",
"port": 22,
"sasOptions": [],
"autoExec": []
}
}
},
"SAS.results.singlePanel": true,
"SAS.flowConversionMode": "Node",
"SAS.results.sideBySide": true,
"SAS.results.html.enabled": true,
"SAS.results.html.style": "(auto)",
"SAS.log.showOnExecutionStart": true,
"SAS.log.showOnExecutionFinish": true,
"SAS.userProvidedCertificates": [
"/path/to/Certificate", ...
]
}
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.