10-26-2016 07:49 PM - last edited on 10-27-2016 09:29 AM by LinusH
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(%,(,%))));
10-27-2016 04:37 AM
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?
10-27-2016 02:26 PM
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.
10-27-2016 03:03 PM
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.