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.
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.