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.
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.
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.
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).
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.
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):
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.
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.
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 interface. Documentation 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.
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).
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.
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.
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.
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.
Code above can be found in Code4ViyaJob4VAExample.txt in the attached LowNoCodeSASStudio.zip.
10. Prepare and explore data tasks
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.
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.
Last step code above is in WithPartitionLoadCUSTCHURN2CAS.sas in attached LowNoCodeSASStudio.zip.
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
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.
[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.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.