Dear SAS community, I have a question. I am currently building models for a predicting project. I'm starting with hundreds of variables on hand. Specifically, for example. I have 20 base variables X1,X2,X3...X20. Each variable has 6 transformations. For example X1_lag1, X1_lag2, X1_lead1, X1_lead2, X1_avg4m, X1_avg4m Now I'm having this problem: for certain variables, I need to exclude certain transformation. For example, for variable X5 and X10 in particular, I need to remove the lead transformation of X5 and X10. I wrote the following code and it works, PROC SQL; SELECT DISTINCT variable_name INTO :selected list FROM var_list WHERE upcase(name) not like %X5_LEAD1% AND upcase(name) not like %X5_LEAD2% AND upcase(name) not like %X10_LEAD1% AND upcase(name) not like %X10_LEAD2% ; QUIT; But the problem is that in reality, I have hundreads of variables whose certain transformations need to excluded. what I need now is a more flexible way to write the code that I can change the combination of base variables and transformations that I want to exclude. Currently, the code is manual and not very effective. I tried call execute but it doesn't work. I tried write a loop using arrays in a macro but having some difficulties. Can anyone point me to some examples, that'd be great. Thanks! Ideally, I want to write a macro, the input has two elements, 1. the list of base variables; 2. the list of tranforms. Then every possible combination of base variable from list 1+transformations from list 2 will be excluded. Then by executing the macro, goals are achieved. No need to manually to update/change/write a complete list of upcase(name) not like %X5_LEAD1% AND upcase(name) not like %X5_LEAD2% AND upcase(name) not like %X10_LEAD1% AND upcase(name) not like %X10_LEAD2% I am able to allow the baseline variable be a macro, but still the problem of the code below is that only one variable can be executed at one time. Is there anyway to do a list of variables at one time? %LET VARN=var5; PROC SQL; SELECT DISTINCT variable INTO :selected_list FROM var_list WHERE upcase(name) not like cats('%',"&VARN.",'_LEAD1%') AND upcase(name) not like cats('%',"&VARN.",'__LEAD2%') ; QUIT; Thanks!
... View more