Hi
I came across a code that sequentially takes a string from a list of strings (&syspbuff) separated by a "," or " ".
but I don't quite figure out why the delimiters should be %str(%,(,%))) ?
%let data_input = %scan(&syspbuff,1,%str(%,(,%))));
If &syspbuff contains commas, this will fail anyway, as the first comma will be interpreted as a parameter separator for the %scan function.
What do you (or the previous programmer) try to achieve with this?
Thanks for reply.
The macro uses parmbuff option. &syspbuff is something like: (input_data, output_data, event_indicator, input_var)
among the parameters, the input_var itself is a list of variables separated by ",".
That line of code sequentially takes these parameters one by one. so the %scan function should use delimiters including , and left and right parentheses. I cannot figure out why the delimiter portion is written that way.
You may want to show 1) and example of how the macro is called actually called and if any of the parameters are macro variables what each of those macro variables resolve to at the time the macro is called. 3) It may be a good idea to show the entire macro code as well.
Imbedded special characters and for macro parameters comma is a special character can be touchy.
Are you passing values to the macro that include ( or ) as part of the value?
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.