I am currently attempting to create a macro that is setting parts of a string to a list of global variables where the parts of the string are separated by "-" so for example, 672-46-246 would make three global variables, name2, name2, and name4, which are called 672, 46, 246 respectively. There's also a name1 which is the global variable of the entire string. But anyways I got the ability to get the entire string to a global variable but I'm having trouble splitting it up. There may be other ways to do this but what I'm trying to do is doing a for loop to how many "splits" there are, i.e. "-" and then substringing it by those splits. Right now I'm trying to find out how many "splits" there are but the code is returning
ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: &splits.
Not sure what else to include here in the summary.
Code below
%GLOBAL C;
%LET C=1;
DATA _NULL_;
SET T_&scope.;
%DO I = 1 %TO &sqlobs.;
%GLOBAL name&C.;
CALL SYMPUT("name&C.", COL&I.);
%Counter(C);
CALL SYMPUT("splits", COUNTC(COL&I., "-"));
%DO J = 0 %TO &splits.;
%Counter(C);
%END;
%END;
RUN;
WARNING: Apparent symbolic reference SPLITS not resolved. ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: &splits.