BookmarkSubscribeRSS Feed

How to use VS Code with SAS OnDemand for Academics

Started ‎02-08-2024 by
Modified ‎09-19-2024 by
Views 10,248

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 SODAVS 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:

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 detailsWelcome 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.

 

  1. Press Ctrl+Shift+P or F1 to show available commands, and select "SAS: Add New Connection Profile".
    _1_addprofile.png
  2. Assign a name for this connection profile. I've used "SODA" here.
    _1a_setname.png
  3. Select the SAS 9.4 (remote - IOM) connection type.
    _2_selecttype.png
  4. Enter the server name that is associated with your host region. Then confirm the Port number (always 8591 for this environment).
    _3_servername.png
    _4_portnumber.png
  5. Enter your SAS OnDemand for Academics username.
    _5_username.png

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.

activeprofile.png

 

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.

submit.png

 

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!

_6_password.png

 

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 CodeAnatomy of your SAS environment in VS Code

 

Comments

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

 

Rajaram_0-1707899025688.png

 

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!

Tom

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:

Tom_0-1708043644303.png

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:

"SAS.connectionProfiles": {
        "activeProfile": "SODA",
        "profiles": {
            "SODA": {
                "connectionType": "iom",
                "sasOptions": [],
                "host": "odaws01-euw1.oda.sas.com",
                "port": 8591,
                "username": "my user ID here"
            }
        }
    }

Somebody any thoughts, please?

@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.

 

itconfig.png

Problem is here .

Ksharp_2-1708143622065.png

 

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. 

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:

ryan1919_0-1718221071541.png

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

 

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.

Is it because the encryption type does not support TripleDES that the VSCode plug-in cannot connect to SAS Studio?

Angelfish_1-1718498250088.png

 

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.

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

 

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.

 

 

 

Capture.JPG

 

it works after I install latest vscode, but  no connection with a warning as below

Capture sas.JPG

Asia Pacific Home Region 1

https://odamid-apse1.oda.sas.com
odamid-apse1.oda.sas.com

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.

Version history
Last update:
‎09-19-2024 02:45 PM
Updated by:
Contributors

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Tags