BookmarkSubscribeRSS Feed

Take the Low Code / No Code SAS Studio plunge!

Started ‎02-04-2022 by
Modified ‎02-28-2022 by
Views 6,192

 

SASStudioTakeThePlunge.jpg

 

 

The companion summary video to this article can be found here.

It is part of the SAS How To Tutorials video series.

 

As a Technical Advisor on the SAS Visual Analytics (VA) adoption team, I empathize with those users who have grown accustomed to point-and-click development of their reports, dashboards, and data storytelling (including the data preparation necessary to facilitate such endeavors).  Self-Service Data Preparation has been inherent within SAS VA for several past releases.  In recent times, there has been a growing field known as Data & Analytics Engineering.  Analytic teams (which have now absorbed report, dashboard and data storytelling initiatives and resources) need better support to build data pipelines for whatever BI question they happen to be working on.

 

SAS VA users do not have to necessarily now learn coding to transform data into clean, reliable data sets for analysis and having to learn and apply software engineering best practices to analytics code and data pipelines.  The same SAS Studio that has modernized SAS data and analytics programming efforts with an interactive development environment can be used in the following manner as well.

 

 

LowCodeNoCode.jpg

 

 

I personally went through the process of learning SAS Studio for SAS Viya and seeing how wonderful it is to work with in concert with SAS VA.  What follows are 10+ example areas that a SAS VA user (or any SAS Viya visual product interface) should embrace.  I encourage users to comment back at the end of this community article as to what listed or additional features within SAS Studio benefited you personally or your organization specifically from a Low Code / No Code point of view.

 

 

Where2FindSASStudioMenuItem.jpg

 

 

 

I intentionally utilized a SAS Viya system where I have NO system administration authorizations (e.g., SAS Environment Manager, CLI, Kubernetes, etc.) to mimic the true experiences of a typical point-and-click SAS VA user as close as possible.

 

The data files used for the following illustrations can be found in the attached LowNoCodeSASStudio.zip.  In the business story line simulated (a fictitious telecommunications company), our analysts are interested in churners (customers who discontinue service).  In this scenario, the company has customer data from 3 data sources (each from a different department): Accounts, Billings and Equipments.  They would like (among other needs) to join all 3 datasets, remove some missing values and run some analyses.  The combined data needs to end up in-memory to the SAS VA user community (or any SAS Viya visual product interface). 

 

I used my personal SAS Server/Home location (to upload source data), WORK data library (for temporary created target data), CASUSER CASLIB data library (for in-memory created target data), and My Folder location (for created SAS Studio content) as assigned by my systems administrator per my log-in to my SAS Viya system.  In a real-life customer Test and Production environments, you’ll want the end result in-memory tables (for SAS VA) to reside in a publicly available (group authorization) global session CASLIB.  If source data or SAS Studio content needs to be shared as well in your environment, you’ll want to work with your SAS Viya system administration.

 

More information on where are the files that you have access to through SAS Studio can be found here.

 

 

  1. Quick access to server and local storage data

 

We will perform the ‘Upload files’ (only for now) based on a different example documented here.  Be sure to open the Explorer panel on the left-hand side of SAS Studio to enable the following.

 

1of10_Illustration.jpg

 

 

More detailed information on SAS Studio accessing data into SAS Viya can be found here.

 

 

  1. Multi-step (orchestrated) data engineering

 

A flow is a sequence of operations on data.  Data and operations are represented in the flow by nodes.  A flow can include a series of nodes in which the output of one node is the input to another node.  As you build a flow, SAS Studio automatically generates SAS code for each node. You can use flow to prepare data for reporting and analysis.  We will end up with everything depicted in the following screen capture after step series #4 later within this write-up (be sure to connect the steps within the flow).

 

 

2of10_Illustration(1of2).jpg

 

 

You also have the ability to control the execution order of individual flows within a flow file in SAS Studio.  This is done by grouping the individual flows (or nodes) into "swimlanes" and specifying the order in which the "swimlanes" are executed.  

 

In the meantime, we want to end up with the source file references and imports (with Horizontal Flow Layout which helps with debugging if issues arise).  Take advantage of horizontal re-sizing of screen.

 

 

2of10_Illustration(2of2).jpg

 

 

Accounts.txt is space delimited and should have 3,714 records and 5 columns.  Billings.txt is tab delimited and should have 3,714 records and 6 columns.  Equipments.xlsx is an Excel data sheet and should have 3,715 records and 3 columns.  Be sure to save the flow to Folder Shortcuts -> Shortcut to MyFolder.

 

 

 3. More and enhanced data transformation capabilities

 

 

There are a multitude of SAS data manipulation functions at your disposal within SAS Studio.  Working with a Query, we will re-format (with calculated columns), re-order and filter some of the data.  The result will be a will be a join of all three imported source tables.  Although all of this may have been possible through one Query, to re-emphasize the nature and benefits of multi-step (orchestrated) data engineering, we will add these to our existing flow (this is just a small sampling of overall capability):

 

 

3of10_Illustration (1of2).jpg

 

 

Some of the character data needs to be numeric (SAS INPUT function expression) and vice versa (SAS PUT function expression and with COMPRESS).  Before our users create tables, charts, etc. we want to also remove missing data from the variable Target_Churn since they are interested in doing an analysis on this variable.  Target_Churn=1 means the customer has churned (left) and 0 means the customer has remained.  We will remove the missing values for this variable by filtering the data.  We were asked to move Target_Churn and Current_Bill_Range right after Account_ID (as the first three data items in order) since they are important variables to the users.  When performing the join do not add the 2 extra occurrences of Account_ID.  The join should result in 3,694 rows and 12 columns.

 

 

3of10_Illustration (2of2).jpg

 

 

solution for Account_ID_Char -> COMPRESS(PUT(t1.Account_ID,9.))

 

 

 4. Loading/refreshing data to SAS VA (or any SAS Viya visual product interface)

 

 

Snippets are lines of re-usable and re-purposeable code templates.  Snippets can contain SAS code, XML code or text. You can insert Snippets into Program Editor, XML editor, text editor, flows, job definitions, job forms or job prompts.  SAS Studio is shipped with several code Snippets.  One benefit to SAS VA (or any SAS Viya visual product interface) is Load Data to CASLIB.  We will only use the Load SAS data set from a Base engine library part of the code and make edits to correspond to our data within the flow.  First, we will create a temporary output table connected from the previous steps so it can serve as our physical base table from which to create the in-memory target and for other examples that follow.

 

 

4of10_Illustration.jpg

 

 

Final load code is in LoadCUSTCHURNfromWORK2CAS.sas in the attached LowNoCodeSASStudio.zip.

 

 

 5. User-defined data formats

 

 

SAS provides formats for controlling how variables are displayed. You can use the FORMAT procedure in your SAS programs to create your own formats. The FORMAT procedure supports the creation of user-defined formats in catalogs on the SAS Compute Server. It also supports adding formats and format libraries for a SAS Cloud Analytic Services session.  This will be our first opportunity and only time within the context of this article where we would have had to write all of our code from scratch 😊 but you can copy/paste the provided code.  It is based on this referenced white paper (which describes various ways to accomplish the same user-defined outcomes).  This is also the only topic within the context of this article where a SAS Viya system administration authorization is required after a FORMAT is created by a SAS Studio user so it can be accessible outside of SAS Studio by any SAS Viya visual product interfaceDocumentation guidance and best practices are available.

 

Code example as it applies to the previous steps (i.e. it assumes the SAS Studio To VA flow has run successfully first) can be found in UserDefinedFormatExample.sas in the attached LowNoCodeSASStudio.zip.  SASStudioSuperUserLoadFormatsSample.sas is an example of what that user authorization could then do without leaving their SAS Studio session to make them globally available.

 

 

5of10_Illustration.jpg

 

 

 

6. Examine data tasks

 

 

SAS Studio is shipped with several predefined point-and-click tasks (organized into categories). Some categories and their tasks might not be available at your site because you do not have the required SAS license.  Although we will be looking at this slightly out of order, the Examine Data Tasks are suggested prior to loading your data into SAS VA (or any SAS Viya visual product interface).  It could help in discovering which data needs to be transformed.  Other suggestions (though not depicted here) include the Visualize Data Tasks as preliminary SAS VA usage (where the final production report/dashboard/data story will reside), as well as any of the statistical tasks as preliminary usage to any SAS Viya visual product interface (where the final production analytical models will reside).

 

 

6of10_Illustration.jpg

 

 

7. SAS Studio results output options

 

 

Any SAS Studio functionality that produces output places it in HTML format by default.  You can set the Results Preferences to include any/all of HTML, PDF, Word, RTF, Excel or PPT formats, each with differing output styles.  You can customize the SAS Studio output environment to generate output for other output destinations or use a custom style for your output.

 

 

7of10_Illustration.jpg

 

 

 

 

 

8. Create and schedule jobs

 

 

With our flow after step series #4 above (or from any saved flow), we can schedule it as a job.  In the New Trigger window, specify how frequently to run the job.  You can also specify the time at which the job should run and the start date and the end date for running the job.

 

 

8of10_Illustration.jpg

 

 

If multiple flows need to be dependent of each other, it is recommended to perform this as a SAS Viya system administration function.  Documentation guidance and suggested tips are available.

 

 

9. SAS Viya jobs also to create custom SAS VA functionality

 

 

SAS Viya jobs are not limited to flows.  You can use jobs for web reporting, performing analytics, building web applications and delivering content to clients such as SAS Studio.  These jobs can access any SAS data source or external file and create tables, files, or other data targets that are supported by SAS.  You can create an HTML form or task prompt to provide a user interface to the job. When the user selects an option to submit the information, the data that is specified is passed to a SAS session as global macro variables. The SAS program runs, and the results are returned to the web browser.  This is a neat way to create custom SAS VA functionality.  As an example, we will use CASUSER.CUSTCHURN (from previous examples) and SAS Tasks -> Visualize Data -> Graph -> Mosaic Plot to generate the code we need for the job (that will run on-demand and not scheduled).  Do NOT use WORK.CUSTCHURN as it’s temporary.

 

 

9of10_Illustration(1of3).jpg

 

 

Copy and paste the code into a new Job Definition.  We will add ODS graphics on and off statements so the output can render in the interfaces outside of SAS Studio and then close out nicely.  The metadata folder where this is saved is where the SAS VA report will need to access.

 

 

9of10_Illustration(2of3).jpg

 

 

Code above can be found in Code4ViyaJob4VAExample.txt in the attached LowNoCodeSASStudio.zip.

 

The job content object within SAS VA enables you to display the output from the SAS Viya jobs.

 

 

9of10_Illustration(3of3).jpg

 

 

10. Prepare and explore data tasks

(for the SAS Visual Statistics and SAS Visual Data Mining & Machine Learning user)

 

 

Preparing data for analytical modeling within any SAS Viya visual product interface can be performed by the SAS Viya Prepare and Explore Data tasks (e.g. Imputation by choosing which columns get which types of imputation).  We will run through Partitioning as an example to simulate creating Training, Validation and Test for model evaluation purposes.  These can run directly on in-memory data.

 

 

10of10_Illustration(1of2).jpg

 

 

We will then use the code generated as basis to alter the original flow from step series #4 (a different saved version of it for backup purposes) and follow the trick documented here to run PROC PARTITION and global promote the in-memory table within the same set of code by utilizing CAS ACTIONS.  This likewise will make the in-memory table available outside of our SAS Studio session.

 

 

10of10_Illustration(2of2).jpg

 

 

Last step code above is in WithPartitionLoadCUSTCHURN2CAS.sas in attached LowNoCodeSASStudio.zip.

 

 

ButWaitTheresMore.jfif

 

Bonus. Custom Steps

 

Custom Steps enable you to create a user interface for other users at your site to complete a specific task.  Custom Steps are saved to SAS Content, so they can be shared with others at your site.  Currently, Custom Steps are utilized in a flow.  Future product plans include the ability to run them stand-alone (as a http URL, for example).  Going through the three examples depicted within the documentation, make the following changes if desired:

* Instead of using SASHELP.CLASS -> use CASUSER.PART_CAS_CUSTCHURN (from example #10 above)

* Instead of using Age -> use Num_Acct_Age_Months

* Instead of using Height -> use Num_Avg_Days_Deliquent

* Instead of using Weight -> use Num_Avg_Talk_Hrs

 

 

CustomStepExample.jpg

 

 

For more information on Custom Steps, please consult these community articles and instructional video.

 

 

CONCLUSION

 

 

Summary_Illustration.jpg

 

 

As the name suggests, Low Code / No Code is a method of performing functionality with little or no coding.  This enables users to drag-and-drop pre-configured blocks, and create simple to advanced, enterprise-grade pipelines.  Utilizing SAS Studio in such a manner within the same interface as those who prefer coding has the added benefit to the SAS community of sharing and collaborating in Data & Analytics Engineering projects.  And it’s a seamless integration switching between the SAS VA “programming” environment (SAS Studio) and the SAS VA explore & visualize design environment (SAS VA itself).  Again, we look forward to reading your comments at the end of this community article as to what listed or additional features within SAS Studio benefited you personally or your organization specifically from a Low Code / No Code point of view.

 

 

SASStudioNoDoubt.jpg

 

 

[Update] SAS Studio 2021.2.3 (January 2022) was utilized for the above demonstration.  Since then, 2021.2.4 (February 2022) has introduced two new additional Low Code / No Code capabilities:  Load Database Table and Notes.  Going forward, to keep up to date with new SAS Studio features (regardless if related to Low Code / No Code), please consult the What's New Guide on a regular basis.

Comments

Thanks, this is interesting.  As a programmer, I'm typically not interested in low code / no code.  But, given that there is obviously value to having no code/low code options, I'm glad that they are being incorporated into Studio. 

 

In the past, when I looked at the VA visualize & design environment, it always felt very foreign / non-SASsy.  

 

But if more low-code data prep / reporting can be done in Studio, that would allow me (as a programmer) to work more collaboratively with those using low-code tools.

Version history
Last update:
‎02-28-2022 04:35 PM
Updated by:
Contributors

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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