BookmarkSubscribeRSS Feed
blueskyxyz
Lapis Lazuli | Level 10

 

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;

2 REPLIES 2
andreas_lds
Jade | Level 19

Sorry, but i don't understand your question. Please post data in usable form and show the expected result.

ballardw
Super User

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

 

 

sas-innovate-wordmark-2025-midnight.png

Register Today!

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.


Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 700 views
  • 1 like
  • 3 in conversation