BookmarkSubscribeRSS Feed

Top 10 Tips & Tricks for Building Custom Steps in SAS Viya

Started Wednesday by
Modified Wednesday by
Views 118

Custom Steps enable you to create a user interface to complete a specific task.  Available custom steps are listed on the Steps pane in SAS Studio on the Custom Steps tab. They can then be used in multiple SAS Studio Flows or stand-alone to ensure a common, repeatable process.

 

Below are the top 10 Tips and Tricks for building custom steps in SAS Viya.

 

1_MKQ_CSTips.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.

 

Let’s look at each of these in more detail.

 

 

1. Review the custom step sample controls

 

The sample controls provide an explanation for each of the control types you can use when designing a custom step.

 

In SAS Studio on the Steps pane, select icon1_New_CS.pngSample controls

 

02_MKQ_SampleControlsMenu.png

 

On the Design tab, select Data in the Control Library section to view the Data page of the Sample Controls custom step.

 

03_MKQ_SampleControlsData.png

 

There is an example and text explanation for each of the Data controls with the exception of the Output Table data control.  There is an example and text explanation of that control on another page.

 

Select Controls in the Control Library section to view the Controls page of the Sample Controls custom step.

 

04_MKQ_SampleControlsControls.png

 

There is an example and text explanation for each of the Common controls.  Expand the control to view each example and text explanation.

 

Select Dependencies in the Control Library section to view the Dependencies page of the Sample Controls custom step.

 

05_MKQ_SampleControlDependencies.png

 

There is an example and text explanation for dependencies with check box, number field, and drop-down list.  Expand the control to view each example and text explanation.

 

Select Output in the Control Library section to view the Output page of the Sample Controls custom step. On this page is an example and text explanation for the Output table Data control.

 

06_MKQ_SampleControlsOutput.png

 

 

2. Review the custom step starter templates

 

The starter templates are example custom steps with associated program code, so you can review some real-life examples of how they were built.

 

On the Steps pane, select icon2_New_CS.png Starter templates → Basic - Rank.

 

07_MKQ_StarterTemplateBasic.png

 

There are also more complex starter template examples to review; however, for this post we will focus on the basic example.

 

Select the Select an input table control to view its properties.

 

08_MKQ_RankInputTableControl.png

 

The property ID for the control is inTable.

 

Select the Add a numeric column control to view its properties.

 

09_MKQ_RankNumbericControl.png

 

The property ID for the control is rankBy.

 

Select the Specify the output table control to view its properties.

 

10_MKQ_RankOutputTableControl.png

 

The property ID for the control is outTable.

 

Select the Create a new column for the ranked column check-box control to view its properties.

 

11_MKQ_RankCheckBoxControl.png

 

The property ID for the control is createNewVariables.

 

Select the Program tab to view the code for the custom step.

 

12_MKQ_RankProgram.png

 

The screenshot above shows the property ID references for the various controls from the user interface design for the custom step.

 

 

3. Search the Custom Step GitHub Repository

 

Search the Custom Step GitHub Repository for any similar custom steps that you may be trying to build and download them to use as a starting point for your design.

 

In a browser enter: https://github.com/sassoftware/sas-studio-custom-steps. At the bottom of the page, you can view the README information for the repository.  Select the link for List of custom steps in this repository.

 

13_MKQ_CustomStepRepoREADME.png

 

Scroll down until you locate the entry for GeoDistance with Rounding in the table of Available Custom Steps.

 

14_MKQ_CustomStepListing.png

 

Select the link for GeoDistance with Rounding to view additional descriptive information about the custom step.  On the left-hand side in the Files section, select the GeoDistance with Rounding.step.

 

15_MKQ_SelectCustomStepFile.png

 

Click icon3_Screenshot 2026-05-05 155928.png to download the file for this custom step.

 

16_MKQ_DownloadCustomStepEntry.png

 

Return to SAS Studio and select icon4_Screenshot 2026-05-05 160111.png to view the SAS Content folders.  Expand the SAS Content folder and select the Public folder (or whatever folder to which you want to upload the custom step).  Click icon5_Screenshot 2026-05-05 160257.png to upload files to the selected folder.

 

17_MKQ_UploadFilesToPublic.png

 

Click icon6_Screenshot 2026-05-05 160510.png and navigate to Downloads folder.  Select the GeoDistance with Rounding.step file and click Open.

 

18_MKQ_SelectDownloadedStep.png

 

Click Upload to upload the attached file(s).

 

19_MKQ_UploadStepFile.png

 

Select icon7_Screenshot 2026-05-05 160632.png to view the Steps pane.  Select the Custom Steps tab to confirm the GeoDistance with Rounding custom step is listed.

 

20_MKQ_UploadedCustomStepListing.png

 

There is a SAS Community article on how you can download all the custom steps for this repository.

 

 

4. Test the custom step using stand-alone mode

 

Use the stand-alone mode to quickly test your custom step.  To do this for the GeoDistance with Rounding custom step, in the Steps pane, select the GeoDistance with Rounding custom step and right-click then select Open to open the custom step in stand-alone mode.

 

21_MKQ_OpenCustomStep.png

 

Select the following required information for the custom step and click icon8_Screenshot 2026-05-05 160738.png to run the custom step in stand-alone mode.

 

  • Input table: AFRICA
  • Calculate distance in: Miles
  • Location 1:
    • X
    • Y
  • Location 2:
    • LAT
    • LONG
  • Output table: TEST

 

22_MKQ_RunGeoDistanceCS.png

 

Review the Output Data tab.

 

23_MKQ_GeoDistanceCSOutput.png

 

 

5. Review the log for macro variable names and values

 

Review the log for the macro variable names and their respective values.  Select the Log tab and expand the section named /*region: Generated macro initialization*/.

 

24_MKQ_MacroInitializationSection.png

 

Scroll up to the section heading named /* Macro variables derived from user input to this step - BEGIN */ to view macro variable names and current values for the user input from the custom step.

 

25_MKQ_BeginMacroInputSection.png

 

Notice that the macro variable disType is set to Miles.

 

26_MKQ_disTypeValue.png

 

Scroll to the section closer named /* Macro variables derived from user input to this step - END */. This ends the section of the macro variable names and values for the user input from the custom step.

 

27_MKQ_EndMacroInputSection.png

 

 

6. Use %put statements to aid in the testing of your code

 

Use %put statements to aid in the testing of your code.  This allows you to write out values or show that you have reached a particular portion of the code.

 

In the Steps pane, select the GeoDistance with Rounding custom step and right-click then select Edit to open the custom step in edit mode.

 

28_MKQ_EditGeoDistanceCS.png

 

Select the Program tab to view the code for the custom step. Add the following line at the beginning of the code block and save the changes.

%put The value of disType is: &disType;

 

29_MKQ_PutStatementInCode.png

 

Now, when the same test from the previous section is run the value of the disType macro variable written to the log.

 

30_MKQ_PutStatementValue.png

 

 

7. Use %global statement to assign macro variable values for use outside of the custom step

 

Use a %global statement to assign macro variable values for use outside of the custom step, if needed.

 

On the Program tab, add the following lines of code at the beginning of the code block and save the changes:

%global g_disType;

%let g_disType=&disType;

 

31_MKQ_AddGlobalStatement.png

 

Now, the global macro variable &g_disType can be referenced outside of the custom step in a SAS Studio flow.

 

 

8. Use the New column control (if your code creates a new column)

 

Use the New column control if the code within your custom step creates a new column.  You can hide this column if you don’t want the end user to change the name or you can choose to display it if you want to give the end user the opportunity to name the new column.

 

Select the Design tab to view the page design(s) for the custom step.  Select the Calculate Geo Distance page tab and then select the Distance between the locations new column control to view its properties.

 

32_MKQ_DistanceNewColumn.png

 

The ID name for the control is newColumn.

 

 

9. Use Port Details to control the output columns

 

Use Port Details to control the output columns from the custom step.  If removing columns, you also need to remove them in the code of the custom step.

 

Click icon9_Screenshot 2026-05-05 160924.png to view the port details for the custom step.  Select icon10_Screenshot 2026-05-05 161038.png in the Output Tables section to view the output table structure for the custom step.

 

33_MKQ_ViewPortDetails.png

 

All the columns from the input table are part of the output in addition to the new column Distance between the locations.

 

34_MKQ_OutputTableMetadata.png

 

If you decide to drop columns from the output table, then you should also explicitly drop the columns in the Program code as well.

 

 

10. Create an About tab for the custom step

 

Create an About tab to provide a description of the custom step and its release date information.

 

Click the About page tab for the custom step to view its properties. It is a best practice to include a Text control on this page with information about what the step does and its version information on this tab.

 

35_MKQ_AboutTabCS.png

 

To create a new page for an About tab, select icon11_Screenshot 2026-05-05 161306.png in the Control Library section on the Design tab for the custom step.

 

 

Summary

 

Here is the list of the top 10 tips and tricks for building custom steps in SAS Viya again.

36_MKQ_1_CSTips.png

 

 

Additional Resources

 

Hope you find these tips & tricks helpful!  Here are some additional resources to aid you in building custom steps with SAS Viya.

 

 

 

Find more articles from SAS Global Enablement and Learning here.

Contributors
Version history
Last update:
Wednesday
Updated by:

Catch up on SAS Innovate 2026

Dive into keynotes, announcements and breakthroughs on demand.

Explore Now →

SAS AI and Machine Learning Courses

The rapid growth of AI technologies is driving an AI skills gap and demand for AI talent. Ready to grow your AI literacy? SAS offers free ways to get started for beginners, business leaders, and analytics professionals of all skill levels. Your future self will thank you.

Get started

Article Tags