BookmarkSubscribeRSS Feed

How Do I Modify SAS 9 Programs to Run in SAS® Viya®?

Started ‎12-09-2022 by
Modified ‎01-23-2023 by
Views 1,915

How Do I Modify SAS 9 Programs to Run in SAS® Viya®? Q&A, Slides, and On-Demand Recording

 

Watch this Ask the Expert session to learn how existing SAS®9 programs can be modified to execute in SAS Viya. 

Watch the webinar 

You will learn:

  • The difference between the SAS Viya Compute server and CAS server.
  • How to load and manage in-memory data in CAS.
  • How to modify existing SAS®9 DATA steps and procedures to process in-memory data in CAS.

Modify SAS9 Programs to Run in SAS Viya.jpg

 

The questions from the Q&A segment held at the end of the webinar are listed below and the slides from the webinar are attached.

 

Q&A

Can SAS Viya create projects like EG, so that all SAS files be combined into a project?

Yes. You can build Flows in SAS Studio that are similar to Enterprise Guide projects.

 

 

How will Proc CAS impact overall Viya Env performance if there are many users using CAS functionality/language?

The languages are just converted into the native language of the CAS server (CAS actions). No issues.

 

Does SAS Viya support parquet file extension?

It does.

 

Is SAS Studio the platform for transitioning from SAS 9 to SAS Viya?

SAS Studio is the IDE in Viya.

 

Can you please show how to change the path again?

If you have a path you would like to update in a program, you can certainly type the path yourself. Or an easy trick is to use the Explorer pane to navigate to the file or folder under Files. Then you can right-click on the item and select Insert as Path.

 

How do you give access to data that is on a separate data server (not on SAS/CAS)? In the Windows environment, would it be \\servername\folder\?

If the Windows server is accessible to the SAS Compute Server, it would work just the same here.

 

How about if you want your programs & data to stay on secure servers you control -- not loaded to the cloud? Will SAS-Viya support that?

SAS Viya is flexible and can be installed on a private on prem cloud. This might help: https://communities.sas.com/t5/Ask-the-Expert/Can-I-Deploy-SAS-Viya-On-Premises-Using-Red-Hat-OpenSh...

 

How can I access my Windows Share (where my datasets/flatfiles resides) from the SAS Viya environment?

 

There are two options. First, you can use the Upload button in the Explorer to upload the flat files to a folder under Files, which is the mounted network file system in your SAS environment. Second, your administrator can configure the NFS to map to your Windows drive, allowing for direct access.

 

We have network share (CIFS share) - Can we write libname using network share path i.e., "//network-share/testviyalib in SAS Viya environment?

Your administrator must configure the NFS mounted in the SAS environment to map to your Windows drive, allowing for direct access.

 

For the Python submission, do you need to have something specific installed/configured to do that? Can you do that with R?

Here are some helpful links for resources about integrating with Python and R:

https://developer.sas.com/guides/python.html

https://developer.sas.com/guides/r.html

 

Can process flows created in SAS EG be imported into SAS Studio in Viya as .flw files?

The answer is yes. In SAS Viya, the Environment Manager application provides a migration tool to convert Enterprise Projects (.egp) into SAS Studio Flows (.flw). It's important to note that there's not always a one-to-one correspondence with the Enterprise Guide tasks and the SAS Studio flow steps. For example, you might have something like a bar chart task in an Enterprise Guide project. There isn't a bar chart step in Studio (yet). In that case, the task would migrate into a code note in the flow. Queries migrate over as queries in SAS Studio flows. Import tasks in Enterprise Guide migrate over to an import step in the SAS Studio flow. This migration process is rapidly changing, and new features are being added in every monthly release of SAS Viya. We also have a lot of good content that is out there already on this topic and a whole course that will be ready in January 2023 on migrating Enterprise Guide projects to SAS Studio flows. Here are a few resources:

Blog post: https://communities.sas.com/t5/SAS-Communities-Library/Go-with-the-flow-migrating-Enterprise-Guide-P...

YouTube Demonstration: https://www.youtube.com/watch?v=wf1RL8U75YM

 

I use ON DEMAND SAS for SAS BLOGS and SAS Conferences. Does ON DEMAND have the batch submit feature? I get frustrated to use %SYSMSTORECLEAR; to clear MACRO CATALOGS or SAS FORMAT CATALOGS.

SAS On Demand for academics is not SAS Viya - it is SAS 9.4 and does not include many of the fancier features of Viya. As far as I know, there is no batch submit capability in SAS On Demand, as it is intended for learning and not for production work.

 

Is this mycas lib path mapped to CAS server?

Yes, mycas is a caslib based on a path. It points to a physical location on the mounted NFS on the CAS server and allows for data to be loaded into memory for parallel processing.

 

What is the base language used to develop SAS Viya and CAS server?

Whichever language you would like. 🙂 In the CAS server, the native language is the CAS Language (CASL). However, you can also use Python, R, SAS, SQL, Java, RESTAPIs to process data on the CAS server as well through the CAS API. https://blogs.sas.com/content/sgf/2021/08/06/cas-actions-and-action-sets-a-brief-intro/

 

Can you talk about how a CAS-enabled Data Step differs from a SAS9 Data Step? For example, because the CAS-enabled Data Step runs multi-threaded, if you use RETAIN it retains values within the records processed by each thread. If you use end=eof on the SET statement, you will have multiple records with eof=1. Also, I think record order is not defined.

If you're interested in the deeper dive, we have an entire course on Programming for SAS Viya that shows many different examples. When you do have something in the DATA Step where sequence matters, such as using the RETAIN statement, sum statement for accumulating columns, or the LAG function, unexpected results may occur if the step is processed in multiple threads. The easiest way to ensure sequential processing is to add / single=yes on the DATA statement. You still have the advantage of processing the data in-memory, but it's happening on a single thread so you are maintaining that sequence that is consistent with the Compute server or SAS 9. Here is a helpful video that reviews DATA step processing in CAS:

https://video.sas.com/detail/videos/an-introduction-to-sas-viya-programming-for-sas-9-programmers/vi...

 

Which course would go over setting up a SAS Viya environment, how to connect different databases like Oracle, MS SQL, SAS data files from different locations?

Check out the Administration training path for your flavor of SAS Viya found here: https://support.sas.com/training/us/paths/admin.html

 

This page provides a helpful list of support for the various data sources and corresponding documentation: https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/acreldb/n11enb3qok8zrbn1o8g4x4m7ml4k.htm

 

Once the table is loaded to CAS, does it consume physical memory of CAS or is it just a pointer back to the original location?

In CAS, you must load the data into memory to be processed. It will take up space on the CAS server worker nodes. Once it's in memory, it stays in memory until you remove it. It avoids the constant input/output to and from memory. While the table does consume some memory, it is also backed by a high-speed cache using a format that is very fast loading. This allows Viya to transparently process tables that far exceed the size of available memory.

 

I think the RETAIN documentation for Viya explains it well, but it was still a big surprise to me when I read it.

It's very interesting that it can work in the CAS server. Read about the BY statement in CAS 🙂 https://go.documentation.sas.com/doc/en/pgmsascdc/v_033/casdspgm/p10ux48pz7qknzn1ux1bs48vplnx.htm#p1...

 

Why was Proc Freq not converted to CAS enabled procedure, like Proc Means?

Not sure why. There is a CAS enabled proc called PROC FREQTAB. My guess the way it was created that they needed to create a new procedure to execute it on multiple workers/threads https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/casstat/casstat_freqtab_toc.htm

Keep in mind PROC MEANS is partially CAS-enabled. Not all options are supported by CAS, so PROC MDSUMMARY may be a more complete and efficient option.

 

Can caslib use the DS2 procedure?

DS2 can be executed in CAS, either by using PROC CAS with the SESSREF= option, or by running DS2 code with the ds2.runDS2 CAS action.

 

What is the base language used to build CAS language?

It doesn't really a 'base' language. It a scripting language that contains different variable objects, function, and statements. https://go.documentation.sas.com/doc/en/pgmsascdc/v_033/caslpg/titlepage.htm

 

In SAS Compute Server language, how do I access datasets created earlier in the program or in different programs? We have a series of very old SAS programs that generate and then modify or run stats on the created datasets. The created datasets are visible in the Explorer folders but can't be accessed by the program.

The SAS compute server functions exactly the same as the workspace server in SAS 9. If you create a dataset in a SAS library, you will access it like you always have.

 

Does CAS server exist on SAS Grid environment?

Check out this SAS Global Forum paper on the subject https://www.sas.com/content/dam/SAS/support/en/sas-global-forum-proceedings/2020/4577-2020.pdf

 

Can we use SAS Viya for ETL work - read the data in-memory, manipulate, update and load back to original location?

Of course! You even have the option of using the SAS compute server or the CAS server based on the size of your data and the speed you want.

 

Is the CAS cloud secure? When I was working for a Bank about 2 decades ago, they were hesitant to use clouds.

Cloud security is strong - the government and even the military use cloud. However, the security of the cloud is dependent on how you set up your servers and services. Viya can also be installed on-premises using Red Hat OpenShift if you want more control over that.

 

I'll try again but when we first moved the files from SAS 9.4 to Viya this step stopped working. I've tried retyping the code from a saved copy of the original but no luck.

It's hard to assist without access the environment. I recommend contacting SAS tech support. https://support.sas.com/en/technical-support.html

 

Is there a way to display in the logs the CAS actions used in the Proc/Data step?

There is! Use this statement:  CAS LISTHISTORY _ALL_;  https://go.documentation.sas.com/doc/en/pgmsascdc/v_033/casref/n0z3r80fjqpobvn1lvegno9gefni.htm#p0x2...

 

Can we schedule a job to run when the input datasets are uploaded in the library?

With code, you can.

 

With the move to SAS Viya (looking to the future), will the basics of SAS programming for ad hoc analytics and complex data transformations remain as an integral tool for SAS users?

Short answer: Absolutely!

 

Can you run multiple programs concurrently in Viya? (Not as background jobs)

You can execute code concurrently in the CAS server. https://blogs.sas.com/content/subconsciousmusings/2021/07/06/tips-for-parallel-processing-in-casl/

 

How do I pass data from CAS to compute server and vice-versa?

To go from the Compute server to CAS, data must be loaded into memory. Two common options are to use the DATA step to data to a caslib, or use the CASUTIL procedure and LOAD statement. To go from CAS to Compute, you can also use PROC CASUTIL and the SAVE statement to create a .sas7bdat file.

 

I frequently read a large table (20%2B mil rows) in an Oracle DB - will the entire table get loaded into CAS in preparation of performing a PROC FEDSQL?

You can load the table once, then process as much as you wish without incurring additional I/O overhead. Or, with FedSQL, you can also use implicit or explicit SQL pass-through.

 

If you use the different languages (like open source vs SAS), does it ever become an issue with running and processing data when there's a variety of files all in different languages?

When using the CAS server, you can use CASL, SAS, Python, R and more. Behind the scenes, the other languages code like SAS/Python/R are converted to actions. Check out this blog series for Python. https://blogs.sas.com/content/sgf/2020/06/19/getting-started-with-python-integration-to-sas-viya-ind...

CAS action series: https://blogs.sas.com/content/sgf/2021/08/06/cas-action-a-series-on-fundamentals/

 

How can we migrate 32- and 64-bit formats to SAS Viya that are created in SAS9.4?

See the follow documentation for the FMTC2ITM procedure: https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n0pqclmcjsngiyn0z6fnynufoxec.htm

 

What is the difference on SAS Viya when you use SAS Studio and SAS Studio V to code your programs?

SAS Studio V is associated with SAS Viya 3.5. The version of SAS Studio demonstrated in the session was 2022.09. If you are just submitting programs from a previous version of SAS Studio on Viya, the code will likely perform the same. However, Studio 2020.1 and beyond are required for some of the features demonstrated, including Flows.

 

 

Recommended Resources

Programming for SAS Viya course, available for Live Web and self-paced e-learning

High-Performance Data Processing with CASL in SAS® Viya® course, available for Live Web and self-pac...

An Introduction to SAS Viya Programming for SAS 9 Programmers (free video library)

SAS Tutorial | Coding in SAS Viya

SAS Tutorial | Introduction to CAS and Coding in CASL in SAS Viya

Save 55% on SAS Certificaiton Exams

Moving from SAS®9 to SAS® Viya®

Please see additional resources in the attached slide deck.

 

Want more tips? Be sure to subscribe to the Ask the Expert board to receive follow up Q&A, slides and recordings from other SAS Ask the Expert webinars. 

Version history
Last update:
‎01-23-2023 01:35 PM
Updated by:

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Article Tags