Not sure what your question is. scan is not a macro function, but %scan is. %sysfunc is a macro function that lets us use SAS functions. In your example, you asked about trim, but not about the similar 'left'.
Of course, you could replace the two with %sysfunc(strip(whatever))
Not sure what your question is. scan is not a macro function, but %scan is. %sysfunc is a macro function that lets us use SAS functions. In your example, you asked about trim, but not about the similar 'left'.
Of course, you could replace the two with %sysfunc(strip(whatever))
Art already answered your question. Remember that macro code it just a tool to automate the generation of text that SAS can interpret as code. Trying to think of it as a real programming language will probably get you in trouble.
Tom, How is Sandy doing in your area?
As you have found, most functions just don't exist in macro language. That's why %sysfunc was invented, to allow other functions to be called by macro language. Also note, if your objective is to strip leading and trailing blanks from a macro variable, you don't need a function to do it:
%let a = &a;
The %let statement will ignore the leading and trailing blanks to the right of the equal sign.
Good luck.
There are already some built-in macro function, include TRIM and LEFT .
%let x=%trim(%left(whatever));
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.