%sysfunc - why this function we use?
Documentation:
Execute SAS functions or user-written functions.
Logic:
How does SAS macro processing know if text you type is a string or a function? Wrapping it with SYSFUNC tells the processor that you want to evaluate that function, not treat it as a string.
%let my_func = substr(Awesome, 1, 2);
%let my_func_executed = %sysfunc(substr(Awesome, 1, 3));
%put &my_func;
%put &my_func_executed;
Results:
Macro language contains just a handful of functions. DATA steps, on the other hand, contain hundreds of functions. %SYSFUNC was invented so that you could tell macro language to use a DATA step function. That way, the macro language would not have to reprogram all those DATA step functions into a macro language version. Most DATA step functions (not all) can be called using %SYSFUNC.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.