have variables : x1-x15,
want variables: x1|x2|x11|x12|x13|x15
&want??
%macro have();
%if %sysfunc(prxmatch(/&want./i, x&i.))=0 %then ...........
%mend;
Sorry, but i don't understand your question. Please post data in usable form and show the expected result.
%sysfunc calls seldom work well with data step variables as the values of data step variables are not typically visible to the macro processor.
Please describe in more detail what the variables are and what this result actually looks like: x1|x2|x11|x12|x13|x15
I could interpret that to mean: place a | character between the names of variables; concatenate the values of the variables placing a | between the values; evaluate the expression x1 or x2 or x11 ... ; create string (macro variable???) that is in effect "x1|x2|x11|x12|x13|x15" . Any of the above makes one wonder why x3, x4, x5 etc. are excluded since you say you have variables x1-x15.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.