The VS Code with the SAS extension is becoming a top tier programming client for SAS users. It has many of the features that programmers expect, such as syntax suggestions, built-in syntax help and doc, and the ability to connect to any SAS environment. New SAS learners who rely on SAS OnDemand for Academics had been left out of this experience, but no more! With the latest updates to the SAS extension, you can connect VS Code to your account in SAS OnDemand for Academics (sometimes-but-not-officially called "SODA"). Once connected, you can run code and see your results within VS Code -- no need to log in via a browser.
Before we get into it, I'll admit that this connection type is available only on Windows. If you're running VS Code on a Mac or other device type, this connection won't work. It relies on the Windows-only "SAS Integration Technologies client", working similar to SAS Enterprise Guide. Mac users: I'm sorry. (You can still use the SAS extension to edit and manage your SAS programs, and you can connect to SAS Viya environments, but you won't be able to connect to SAS 9.4 environments with this method.)
This connection is made possible by two innovations:
Before you get started, you will need these prerequisites (all free):
To define your VS Code/SAS profile, you will need to gather the following information from your SODA account:
For example, in this screenshot you can see that my home region is "United States 1" and that my user ID is the value beginning with "u3":
SAS OnDemand for Academics is a large-scale SAS environment that has hundreds of thousands of active users around the globe. The environment is divided into multiple regions with multiple server hosts. Your account is accessible only from the servers in your assigned region, so you need to match your home region with the server name in order to sign in with the SAS extension.
The server/region mapping is defined in the instructions for open-source connections. I've added the current values here for reference, but note that these are subject to change.
With all of the information gathered, we're now ready to add a SODA profile to the SAS extension in VS Code. Complete these steps in your VS Code session.
That's it! Once the profile is defined it should appear as your active SAS profile as indicated in the status area in the bottom of your VS Code window.
Open a SAS program file, or create a New SAS file with VS Code, then click the "running person" (or press F3) to submit it.
The first time that you run a program, you'll be prompted for your SAS OnDemand for Academics password. Type it in the field and press Enter, and your program will run in your SODA account!
Because your program is running in your SAS OnDemand for Academics account, your code can reference any data or files that you have access to in that environment. As your program completes, you'll see the SAS Log in the output area of VS Code, and any ODS HTML results will automatically display in a new Results window.
At this time, the SAS 9.4 - Remote IOM connection does not support navigation for SAS libraries, viewing data sets with a built-in viewer, or remote file access/management. These features are supported for the SAS Viya connection type, and they are actively being worked on for SAS 9.4 - Remote IOM. Coming soon!
Thanks Chris, great article! I finally saw VS Code in action as a SAS IDE at SAS Explore last year, and it was very exciting! I came home an installed VS code and connected it to my local SAS 9 session, and really enjoyed using it. I'll definitely try connecting it to SODA. Also looking forward to seeing VS Code in action in the upcoming ATE on SAS Viya Workbench! https://www.sas.com/en_us/webinars/sas-viya-workbench.html
I am getting an error. The SAS integration technologies client has been installed into my system, still, I get the below error
Hi @Rajaram - I suggest you post this to the project Issues on GitHub. The team is very responsive. This could be an issue with the particular version of VS Code (older versions sometimes cause issues).
@Rajaram Thanks to your report and a few others, the issue has been addressed and new version was published!
If you are not sure where your SAS Workspace Server is but are using SAS/Studio already you might be able to query your SAS Metadata Server to find it. If you run the code in this SAS documentation example.
https://support.sas.com/documentation/cdl/en/lrmeta/60739/HTML/default/viewer.htm#a003272745.htm You should see it in the report it creates.
For example in the example results on that page it shows this line:
Which showing that the server address is myserver and the port number is 8591.
Awesome, will try it
Hello!
SAS throw me an error of connection to ODA.
My config:
@JanKwiatkowski You have the Integration Technologies client installed? If so, you should be able to run itconfig2.exe from your PROGRAMFILES\SASHome\Integration Technologies folder and test the workspace connection. Note the encryption type has to match what the server supports/expects.
Problem is here .
I am getting following error
System.Runtime.InteropServices.COMException (0x80042002): <connectionAttempts>
<connectionAttempt>
<description>Connection timed out. A connection attempt failed because the SAS Server did not properly respond after a period of time, or established connection failed because connected host has failed to respond. </description>
<status>0x8007274c</status>
<saslogin>rajahram</saslogin>
<sasmachinednsname>odamid-apse1.oda.sas.com</sasmachinednsname>
<sasport>8591</sasport>
<sasclassid>440196D4-90F0-11D0-9F41-00A024BB830C</sasclassid>
<sasprogid>SAS.Workspace.1.0</sasprogid>
<threadid>11056</threadid>
<name>test</name>
</connectionAttempt>
</connectionAttempts>
at SASObjectManager.IObjectFactory2.CreateObjectByServer(String Name, Boolean synchronous, IServerDef pIServerDef, String LoginName, String Password)
at SAS.BI.Itconfig.Library.ServerTests.SASServerTest.CreateConnectionWithObjectFactoryMulti()
at SAS.BI.Itconfig.Library.ServerTests.SASServerTest.CreateConnection()
@Rajaram It looks like the server is not reachable from your client machine. Perhaps you are working within a network with a firewall? While your browser might have the ability to route internet traffic through a proxy (so you can get to SODA), maybe other local applications cannot. I'm guessing here, based on other situations I've seen.
@ChrisHemedinger , hello!
Than you for your answer! No, I haven't had installed Integration Technologies client, I have acces to SODA to learn SAS Programmingand now I Try to connect to SODA with VS Code like discribed, but connection is failed.
[Error: There was an error executing the SAS Program. See [console log](command:workbench.action.toggleDevTools) for more details.
at Hx.onShellStdErr ("my local path"\.vscode\extensions\sas.sas-lsp-1.7.1\client\dist\node\extension.js:264:155)
at Socket.emit (node:events:514:28)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:297:9)
at Socket.push (node:internal/streams/readable:234:10)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)]
Now I can only select SASProprietary Encryption method like Ksharp mentioned above.
Note: If you do not have a license for SAS/SECURE, you can only specify the SASProprietary algorithm.
https://support.sas.com/rnd/itech/doc9/admin_oma/security/security_encrypt.html
So users who have no license still cannot be connected in vscode?
At least I can't.
@JanKwiatkowski @sxjeru I'll look into this. The additional cryptography methods are part of a SAS/SECURE client that may not be part of the Integration Technologies client download.
H Chris. I'm commenting here so that I get updated - in case a fix or workaround gets added - to get this working without a SAS/Secure license.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.