BookmarkSubscribeRSS Feed

SAS Studio Custom Steps: Reduce, Reuse & Recycle Part II

Started ‎03-21-2024 by
Modified ‎03-21-2024 by
Views 161

In my previous post, SAS Studio Custom Steps: Reduce, Reuse & Recycle Part I, we discussed how you can reduce setup and configuration time when creating custom steps by reusing the controls in the Sample Controls custom step. Following on from that post, we will now discuss how to recycle custom steps using the SAS Studio Custom Step Repository.

 

Reuse & Recycle

 

SAS Studio custom steps are a great way to promote code reusability. Once developed, they can be used by other SAS Studio users.

 

This video reviews the SAS Studio custom step repository in GitHub where you and other SAS users can publish, share and download custom steps. We will download a single step, upload it into SAS Studio and use it as a standalone step.

 

 

 

Want to try it for yourself? Here are the instructions.

 

View and Investigate the SAS Custom Step Repository

 

    1. To view the SAS custom step repository, go to github.com/sassoftware/sas-studio-custom-steps.
      01_GR_13_GITHUB.png

      Select any image to see a larger version.
      Mobile users: To view the images, select the "Full" version at the bottom of the page.

    2. The repository contains several custom steps, including steps representing advanced data transformations. We recommend checking the built-in SAS Studio steps and the SAS Studio custom steps repository before creating your own custom step, just in case a step already exists that’s the same or similar to your requirements.
    3. Scroll down to the Getting Started section. Click the link labelled Using a Custom Step from the GitHub repository in SAS Studio for the most up-to-date instructions on downloading custom steps from this repository and making them available for use in your SAS Studio environment.
      02_GR_14_GettingStarted.png

       


       You can download the complete repository or a single file step.
      03_GR_14_b-1.png

       

    4. Click the link labelled sas-studio-custom-steps, in the breadcrumbs at the top of the page, to return to the home page.
    5. You are encouraged to participate and contribute to the repository. Scroll down and click the link labelled CONTRIBUTING.md to review how you can contribute your own custom steps!
      04_GR_15_Contributing.png

       

Downloading a Single Step

 

  1. If necessary, click the link labelled sas-studio-custom-steps to return to the home page in the GitHub repository.
  2. Click Lookup to open the folder containing the Lookup step and instructions.05_GR_16_lookup-1.png
  3. The Lookup custom step will add a column to a table by performing a lookup on another table using hash objects. Please be aware that custom steps in the repository are hosted by SAS but contributed to by the global SAS community. This means that they are not guaranteed to be backwards compatible, so it’s advisable to view any requirements, version dates, or both. The Lookup step does not have any requirements.
  4. Click the Lookup.step link.06_GR_16_lookup2.png
  5. Click 01_Icon_GR_Download.png to download the step to the Downloads folder.07_GR_17_Download.png

 

Uploading a Single Step

 

Now we can upload the custom step in SAS Studio.

  1. Log into SAS Studio on SAS Viya.
  2. If necessary, click 02_Icon_GR_Server.png in the navigation pane, on the left.
  3. To make SAS custom steps available in the Shared tab of the Steps section in the navigation pane, we need to save it in SAS Content.  Expand SAS Content.
  4. To make it available to other users, it needs to be saved in a folder that has the restrictions/permission you require. I only have My Folder available to me in my SAS Viya environment which means that, when the custom step is saved, myself and administrators will see it in the Shared tab of the Steps section in the navigation pane but no one else will. Expand Folder Shortcuts and Shortcut to My Folder.
  5. Select 03_Icon_GR_Upload.png to upload the file.
    08_GR_18_Upload-1.png
  6. Click Add and navigate to the Downloads.
  7. Select Lookup.step and click Open.
  8. Click Upload to upload the custom step to your folder.

 

Using a Custom Step in the SAS Studio Workspace

 

Now I can use the custom step in a tab in the SAS Studio workspace, often referred to as standalone. Of course, you can also use this step in a flow if that suits your requirements. We will use the GEOEXM data table from the SASHELP library. This data table contains street addresses from North Carolina. We will use the ZIP Code as the lookup key to return the variable that contains the County name from the ZIPCODE data table, also from the SASHELP library.

 

  1. Click 04_Icon_GR_FlowStep.png in the navigation pane to access the Steps section.
  2. Select the Shared tab and right-click Lookup and select Open in a tab.
  3. Click 05_Icon_GR_DataOutput.png at the end of the prompt labelled Base table. Click SASHELP, select GEOEXM, and click OK.
  4. On the prompt labelled Columns to keep, click 06_Icon_GR_Add.png. Select Name, City, and ZIP and click OK.
  5. Click 05_Icon_GR_DataOutput.png at the end of the prompt labelled Lookup table. Click SASHELP, select ZIPCODE, and click OK.
  6. On the prompt labelled Lookup Key Column(s), click 06_Icon_GR_Add.png and select ZIP and then OK.
  7. Click 06_Icon_GR_Add.png on the prompt labelled Return Column and select COUNTYNM and click OK.
  8. Leave the prompt labelled Value to use when lookup does not return values.
  9. At the end of the prompt labelled Result Table, click 05_Icon_GR_DataOutput.png. Click WORK, enter NC, for North Carolina, in the Table field, and click OK.
  10. Click Submit Custom Step to run the custom step.

09_GR_19_SubmitCS.png

 

The output data table named NC appears to the right of the custom step and contains 21259 rows and 4 columns. The last column, named COUNTYNM, contains the column returned from the lookup.

 

10_GR_20_Output.png

 

 

Summary

 

There are so many valuable assets available regarding SAS Custom Steps for SAS Studio! During this post we downloaded one step, take a look here for advice on uploading all steps from the SAS Studio Custom Step Repository.

 

To summarize:

 

  1. For custom steps to be available in the Shared tab of the Steps section in the navigation pane they must be saved in SAS Content. To make them available to other store custom steps in a folder with the necessary permissions.
  2. Before embarking on creating custom steps, check the SAS provided steps and the SAS Studio Custom Step Repository in case a similar step to your requirements already exists.
  3. Share your finished custom step with other SAS Studio users by adding it to the SAS Studio Custom Step Repository.
  4. Learn more about SAS Custom Steps by attending the Developing Custom Steps using SAS Studio Analyst course.

 

Useful Links:

 

 

 

Find more articles from SAS Global Enablement and Learning here.

Version history
Last update:
‎03-21-2024 06:39 AM
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 Tags