Hi @pradeepvaranasi,
Thanks for adding more details to your initial post. It seems that the technique I suggested is applicable. Here's how:
/* Create test data */
data have;
label CELL_CALL_CNT_M1 = 'count of cell calls-April'
CELL_CALL_CNT_M2 = 'count of cell calls-May'
CELL_CALL_CNT_M3 = 'count of cell calls-June'
CELL_CALL_CNT_M4 = 'count of cell calls-July'
CELL_CALL_CNT_M5 = 'count of cell calls-August'
CELL_CALL_CNT_M6 = 'count of cell calls-September'
;
length C: 8;
run; /* dataset with 6 variables */
/* Select variables */
proc sql noprint;
select name into :vlist separated by ' '
from dictionary.columns
where libname='WORK' & memname='HAVE'
& scan(label,2,'-') in ('April','May','June');
quit;
data want;
set have(keep=&vlist);
run; /* dataset with 3 variables */
As you see, you can choose the appropriate character function, be it FINDW (as in my first example), SCAN (as above), INDEX, ..., and logical operators to specify your filter criterion on the labels.
... View more