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.

 

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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