BookmarkSubscribeRSS Feed

Customizing SAS Studio Taking Tasks to the Next Step

Started ‎09-29-2023 by
Modified ‎09-29-2023 by
Views 293

 

Do you enjoy running statistical analyses without having to know the exact SAS code? SAS Studio tasks give users a nice reminder of the tasks within SAS Enterprise Guide: Open the task and make a few selections from those provided and click the RUN icon. No code knowledge is needed.

 

But what if you wanted to customize these tasks? The purpose of this blog is to compare custom tasks and custom steps in SAS Studio. Maybe your workplace would benefit from a task that would be more specific to the needs of the company. That is the purpose of the custom task within SAS Studio. Using XML coding, you could create your own SAS Studio task and share these with other colleagues.

 

damodl_1_1_blog1_xmlcode.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.

  

Creating Custom SAS Studio tasks reminds me of writing a program within Visual Basic. Step 1, you declare all the objects that will appear within the task. Step 2, you design the user interface (UI) using containers to generate the different tabs within the task.

 

damodl_2_2_blog1_UIcode.png

 

Step 3, you link the UI items to the program code using a macro style structure that grabs the elements selected from the UI.

 

damodl_3_3_blog1_codetemplate.png

 

Optional step 4, you enhance your UI by establishing dependencies that will hide or reveal items as you make specific selections.

 

damodl_4_4_blog1_dependencycode.png

 

 

From Custom Tasks to Custom Step

With all this XML code to be written, there are multitudes of chances for mistakes to be made that can increase frustration and creation time. Let's look at custom steps within SAS Studio and compare them to customized tasks. The largest difference, in development, between a custom task and a custom step is the amount of code you have to write. Rather than declaring the objects that will appear within the step, you simply use the Step Designer to create the tabs and place elements on these tabs.

 

damodl_5_5_blog1_designer.png

 

With each object that is placed on the Step Designer, you provide properties for each of the objects. This is similar to functionality in SAS Enterprise Miner and to Model Studio in SAS Viya.

 

damodl_6_6_blog1_properties.png

 

Each object added will require an ID property to be named. Attention needs to be taken when naming the ID property as that is the reference name used in the program code. Dependencies, such as object visibility when certain selections are made, can also be established within the properties of an object.

 

The largest similarity between a custom task and a custom step is the program code. Much like tasks, the custom step uses a macro style structure linking the items from the UI to the backing program code.

 

damodl_7_7_blog1_stepcode.png

 

When creating a custom step, you do not have to directly type the UI interface code. As you provide items and properties in the designer, the UI code will be written for you. However, one neat trick is that if you are given JSON UI code and copy/paste it into the UI area, the designer items will be created for you.

 

Some objects will self-generate macro variables that can assist you in the creation of the program code. For example, when you place a column selector in the custom step, there will be a macro variable created that tracks the number of variables selected by the user. This can be of use in loops within the program code.

 

For more information about these macros variables and using them, please reference the SAS documentation.

 

Functionally, custom steps can be utilized in either a flow or in stand-alone mode. Stand-alone is similar to a task where it opens within a tab and you make all your selections. Within a flow, the structure matches the style of a process flow in SAS Enterprise Guide.

 

As you can see, there are advantages, in production and use, to using the custom step compared to the custom task. If you have taken the free e-learning course on creating a custom task, you will find that the transition to a custom step is pretty easy.

 

Version history
Last update:
‎09-29-2023 10:34 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 Labels
Article Tags