18%macro irm_tslit_convert(
21 out_filter_variable_table=work.filter_variables,
29 %
if %quote(&out_table) eq %then
30 %let out_table = &in_table;
32 data &out_table %
if %eval(%qupcase(&debug) in YES Y) eq 0 %then
39 rename=(_tslit_filter_value=&variable)
42 length _tslit_filter_value _new_literal $32767 _quote_type $1;
46 do while(find(&variable,
'"'));
52 _quote_start = findc(&variable,
'"''');
53 _quote_type = substr(&variable,_quote_start,1);
54 _quote_end = find(&variable,_quote_type,
'',_quote_start+1);
58 if _quote_type eq
"'" then
60 _tslit_filter_value = cat(strip(_tslit_filter_value),
61 substrn(&variable,1,_quote_end));
69 _new_literal = quote(substrn(&variable,_quote_start+1,_quote_end-_quote_start-1),
"'");
70 _tslit_filter_value = cat(strip(_tslit_filter_value),
71 substrn(&variable,1,_quote_start-1),
77 &variable = substrn(&variable,_quote_end+1);
82 %
if %qupcase(&debug) in Y YES %then
89 _tslit_filter_value = catt(_tslit_filter_value,
97 data &out_filter_variable_table(keep=_filter_variable);
99 &variable = upcase(&variable);
100 &variable = tranwrd(&variable,
"'''",
'');
101 &variable = tranwrd(&variable,
' AND ',
' ');
102 &variable = tranwrd(&variable,
' BETWEEN ',
' ');
103 &variable = tranwrd(&variable,
' CONTAINS ',
' ');
104 &variable = tranwrd(&variable,
' EQ ',
' ');
105 &variable = tranwrd(&variable,
' GE ',
' ');
106 &variable = tranwrd(&variable,
' GT ',
' ');
107 &variable = tranwrd(&variable,
' IN ',
' ');
108 &variable = tranwrd(&variable,
' IS ',
' ');
109 &variable = tranwrd(&variable,
' LE ',
' ');
110 &variable = tranwrd(&variable,
' LIKE ',
' ');
111 &variable = tranwrd(&variable,
' LT ',
' ');
112 &variable = tranwrd(&variable,
' NE ',
' ');
113 &variable = tranwrd(&variable,
' NOT ',
' ');
114 &variable = tranwrd(&variable,
' NOTIN ',
' ');
115 &variable = tranwrd(&variable,
' OR ',
' ');
116 do while(find(&variable,
"'"));
117 _quote_start = findc(&variable,
"'");
118 _quote_end = findc(&variable,
"'",_quote_start+1);
119 substr(&variable,_quote_start,_quote_end-_quote_start+1) =
'';
122 do while(scan(&variable,i,
' !$%&()*+,-./;<=>?^|~',
'o') ne
'');
123 _filter_variable = scan(&variable,i,
' !$%&()*+,-./;<=>?^|~',
'o');
124 if nvalid(_filter_variable,
'v7') then
130 proc sort data=&out_filter_variable_table(rename=_filter_variable=filter_variable)
135%mend irm_tslit_convert;