BookmarkSubscribeRSS Feed

Uploading all Custom Steps from the SAS Software GitHub repository to SAS Viya

Started ‎08-09-2023 by
Modified ‎08-08-2023 by
Views 5,212

At the time of writing the SAS Studio Custom Steps repository  contains 57 Custom Steps. Their functionality ranging from importing data, to doing data quality, over synthetic data generation to NLP functionality - quite the impressive spectrum don't you think?

Screenshot of the official SAS Studio Custom Step repository on GitHubScreenshot of the official SAS Studio Custom Step repository on GitHub

So with that the question arises how to get them into your SAS Viya environment. You could of course dig through every single folder, grab the .step file and upload it by hand...

Ain't nobody got time for that memeAin't nobody got time for that meme

So how can we improve this process? We will take a look at three approaches with differing levels of automation:

  1. The Automator - fully scripted End-to-End
  2. The Lazy - small amount of manual work
  3. The Inbetweener (yes this is a cheap joke)

The Automator - Automation is Life

This first approach makes use of a SAS script that uses the SAS Git functions, macros by the one and only SAS Jedi and SAS Viya APIs. You will have to specify a target folder in which you have already cloned the Custom Steps repository or in which you want it to be cloned and you need to specify a folder in SAS Content that should contain all of the Custom Steps.

* Enter the folder in which the SAS Studio Custom Steps are available;
%let targetFolderServer = /shared-data/SAS-Studio-Custom-Steps;
* If set to one the repository will be cloned into targetFolderServer path;
* Set the value to 0 if you already have the repository cloned;
%let wantCloning = 1;
* If you have the repository already cloned set this to 1 to pull new changes;
%let wantPull = 0;
* Enter the folder where the SAS Studio Custom Steps should be stored in SAS Content;
%let targetFolderContent = /Public/Custom Steps;
* Replace previously already existing steps - set to true if you want to replace steps;
* Setting this to true is recommend if you pull the repository to get updated steps;
%let replaceSteps = false;

If you set the macro variable wantCloning to 1, the script will automatically clone the official SAS Studio Custom Step repository from GitHub.

 

Please note that activating the replaceSteps option can lead to breaking changes and require updates to SAS Studio flows that use updated Custom Steps. This is because Custom Step authors might introduce new required options or other breaking changes.

 

As you can see, you can also configure this to pull in changes and additions that happen overtime. You can get the full SAS code over at my SAS Snippets GitHub repository - here is a GIF showing this script in action - here I specify a folder into which I have cloned the repository using the Git pane in SAS Studio:

Upload and Register all Custom Steps with SASUpload and Register all Custom Steps with SAS

The Lazy - Click, Zip, Select & Upload

This approach was shared with me by @Wilbram-SAS , don't get me wrong I'm not calling him lazy - far from it! The process is simple:

  1. go to the GitHub repository 
  2. download it as a zip
  3. select all of the steps you are interested in
  4. upload them to SAS Content

 

Here is a GIF demonstrating the process:

Download GitHub Zip, select the Steps and Upload to SAS ContentDownload GitHub Zip, select the Steps and Upload to SAS Content

 The Inbetweener - A little bit of scripting, a little bit of dragging

This approach assumes that you have cloned the GitHub repository to your local machine (assuming Windows here) or have downloaded and unzipped it to a folder. We will run a PowerShell command to copy all .step files from the repository folder to one folder so you can quickly drag and drop them into SAS Content.

# Navigate to the path
cd "C:\Users\<username>\Documents\SAS_Repos\sas-studio-custom-steps"
# Create the folder will hold all steps
mkdir ..\All-Steps
# Copy all steps to the new folder
Get-ChildItem -Path ".\*" -Include *.step -Recurse | Copy-Item -Destination "..\All-Steps"

Now you can just select the steps that are of interest to you and upload them to SAS Content:

Clone, Collect, UploadClone, Collect, Upload

Conclusion

Now you have no excuse not to make use of the awesome utility of all of the Custom Steps available on GitHub - enjoy and let me know which method you end up choosing. I know I'm using the fully automated way of doing things!

 

Version history
Last update:
‎08-08-2023 04:24 PM
Updated by:
Contributors

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!

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 Labels
Article Tags