As of SAS Studio version 2022.12, there is a new generated macro variable in town!
Code development and maintenance is much simpler when using the Column Selector control as it now generates a macro variable that lists the columns selected, separated by a space.
When code is generated for a custom step, whether it’s used as stand-alone or in a flow, macro variable(s) are generated for each control in a step. The ID of each control is used to name the SAS macro variables that can be used in the SAS code for your custom step.
This custom step has been opened in a tab in the SAS Studio workspace, also referred to as stand-alone.
The Column selector control, the prompt labelled “Select columns to print”, enables users to select single or multiple columns when executing the custom step. In this case, the user has selected 4 columns to be printed. The generated macro variables for these values are named varList_1_name, varList_2_name, varList_3_name, varList_4_name.
Select any image to see a larger version.
Mobile users: To view the images, select the "Full" version at the bottom of the page.
One strategy when selecting multiple columns involves iterative processing using the macro language %DO statement to list all of the columns selected, separated by a space, for example,
From SAS Studio version 2022.12, you can use the new macro variable generated that simply lists all of the columns selected, separated by a space.
The macro variables generated previously (varList_n_name) are still generated so existing custom steps are not impacted but having one macro variable that lists the values makes coding much simpler to develop and maintain!
If you have SAS Studio 2022.12 and onwards, use the generated macro variable that lists the columns selected in the Column Selector control for easier code development and maintenance!
From this: | To this: |
![]() |
![]() |
Happy Coding!
Check these articles for more information on custom steps:
Viya 2020.1.5 (April 2021) – Introducing Custom Steps in SAS Studio Flow
SAS Viya: Stand-Alone Custom Steps
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
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.