How to use VS Code with SAS OnDemand for Academics
- Article History
- RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
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.
VS Code with the SAS extension, connected to SODA
How to connect VS Code to SODA
Before we get into it, I'll admit that this connection type is available only on Windows. Also (this is an update after some readers tested), the method requires that you have at least another SAS application installed: SAS Enterprise Guide, SAS for Windows, or SAS Add-In for Microsoft Office. (The component that supports TRIPLEDES encryption is needed and is not part of the downloadable package I reference below.) Note that SAS OnDemand for Academics users do have a path to get SAS Enterprise Guide if they are students enrolled in a course that uses it.
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:
- The addition of SAS 9.4 (Remote - IOM) as connection option in the VS Code extension
- The already-documented connection information for open-source clients (like SASPy) to connect to SAS OnDemand for Academics
Setting up the prereqs
Before you get started, you will need these prerequisites (all free):
- An account to log into SAS OnDemand for Academics. This is free for any learner and for non-commercial uses.
- VS Code installed on your Windows device. Add the SAS Extension for Visual Studio Code while you're at it.
- The SAS Integration Technologies Client for Windows -- installed. This is already installed with any local SAS applications like SAS 9.4 for Windows or SAS Enterprise Guide. It's also available as a free download from support.sas.com. (Be sure to get the most recent version.)
To define your VS Code/SAS profile, you will need to gather the following information from your SODA account:
- the "home region" of your SODA connection. This is displayed at the top of the Welcome page after you sign in.
- your user ID. This is available in the dropdown menu next to your profile name
- your SODA password. This is also your SAS Profile password.
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":
Welcome screen with home region, profile details
Finding your server name by host region
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.
- US Home Region 1: odaws01-usw2.oda.sas.com
- US Home Region 2: odaws01-usw2-2.oda.sas.com
- European Home Region 1: odaws01-euw1.oda.sas.com
- Asia Pacific Home Region 1: odaws01-apse1.oda.sas.com
- Asia Pacific Home Region 2: odaws01-apse1-2.oda.sas.com
Define your profile in the SAS extension
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.
- Press Ctrl+Shift+P or F1 to show available commands, and select "SAS: Add New Connection Profile".
- Assign a name for this connection profile. I've used "SODA" here.
- Select the SAS 9.4 (remote - IOM) connection type.
- Enter the server name that is associated with your host region. Then confirm the Port number (always 8591 for this environment).
- Enter your SAS OnDemand for Academics username.
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.
Anatomy of your SAS environment in VS Code
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
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
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
I am getting an error. The SAS integration technologies client has been installed into my system, still, I get the below error
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
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).
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
@Rajaram Thanks to your report and a few others, the issue has been addressed and new version was published!
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
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.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Awesome, will try it
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hello!
SAS throw me an error of connection to ODA.
My config:
Somebody any thoughts, please?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
@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.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Problem is here .
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
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()
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
@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.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
@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)]
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Now I can only select SASProprietary Encryption method like Ksharp mentioned above.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
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.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
@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.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
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.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
SAS Community,
**Newbie here, please excuse any beginner / introductory mistakes.
I have completed all the above noted tasks, and gone through to this step:
"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!"
...and I enter my password, and in the lower right corner, it shows the following error:
If anyone could provide some step-by-step guidance as to how to troubleshoot this, that would be appreciated.
I have also seen some comments about posting this in github for troubleshooting... I don't yet have an account, but will create one here shortly... if there's a specific section this issue should be posted to, a link or description as to the folder/subfolder where to post would be appreciated too!
Ryan
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi.
Are you running this from a business machine where SAS is installed? Or a personal machine with no SAS installation (and SAS/Secure license)? If the latter - you won't get this working - because of the encryption issue mentioned above by @Ksharp and @sxjeru . (the nonpaid for version of SAS Integration Technologies doesn't include the TRIPLEDES encryption method) as commented on by @ChrisHemedinger above. I did manage to make a connection to the SODA account using Python to execute SAS (a bit clunky but it worked in the end - there is more info at the bottom of the page in the link below) - here is the article that helped me get it working.
... use Python to connect to SODA using the saspy package as described here:
https://support.sas.com/ondemand/saspy.html#two
In summary
- setup VS code to execute Python
- download and configure the SASPy package to connect to SODA
- execute a Python script that connects and runs SAS code in SODA
Hope this helps.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Is it because the encryption type does not support TripleDES that the VSCode plug-in cannot connect to SAS Studio?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi All, I have updated the article to include a note that other SAS software is needed to support the connection due to encryption protocols. SAS for Windows, SAS Enterprise Guide, or a few other options will include this. Note that SAS EG is available for free to some SODA users if you're enrolled in a course that uses it.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi @ChrisHemedinger ,
thanks for your explanations.
It would be a real progress if the Integration Technologies client were able to directly connect to SODA - without further SW needed just because of the SAS/Secure license topic (encryption algorithms "SASprorietary" available Integration Technologies client, "TripleEDS" needed but not provided by the Integration Technologies client) - are there any plans to extend the Integration Technologies client accordingly?
Kind Regards
Georg Anfang
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi @ChrisHemedinger ,
thanks for your detail example.
I have a question when I try to add an profile in vscode, it only shows sas viya server for connection type.
it works after I install latest vscode, but no connection with a warning as below
Asia Pacific Home Region 1
https://odamid-apse1.oda.sas.com
odamid-apse1.oda.sas.com
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi @blueskyxyz I'm afraid I can't see what's going on here. It's possible you are experiencing the limitation due to the encryption method mentioned in the article and some comments here.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Is there any plan to update SAS Integration Technologies Client for Windows to add components that support TRIPLEDES encryption? When will this issue be resolved? @ChrisHemedinger
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
@Angelfish The IT client supports TRIPLEDES but only when installed with other SAS applications such as SAS for Windows or SAS Enterprise Guide. This is a software distribution practice meant to comply with some encryption technology regulations, where only known customers can get this from SAS. (IT client, as-is, is downloadable by anyone.)
This makes the VS Code to SAS OnDemand harder, I know. But I don't have another answer right now. If you are part of an educational institution, I suggest looking into SAS Viya Workbench for Learners.