data logStream;
strId=1;strline="xxxxMyJob XX XXX X bbbbbbb aaaaaaa cccccccc";output;
strId=2;strline="https//:xxxx aaaMYJOB XX XXX X";output;
strId=3;strline="xxxx jobstorun XX XXX X";output;
strId=4;strline="xxxx jobstorun myjobXX XXX Xrp";output;
strId=5;strline="https//:xxxx yuiuyhiuo XX XXX X";output;
run;
%let webService=%upcase(myJob);
/* Love the LIKE functionality with wildcard "%" ===> "%string%" */
/*However I would like to remove the hardcoding MYJOB to be replaced by the macro variable <webService>.
I have tried all the quoting functions(%str, %nrstr,%unquote,%bquote, %quote, %nrquote, etc..." unsucessfully. Definitively I don't understand them.
Please help and correct the commented line below.*/
proc sql;
create table work.lines as
select t1.*
from work.logStream t1
where upcase(strline) like "%MYJOB%" and NOT upcase(strline) like upcase("%https%") /*works */
/* where upcase(strline) like "%&webService%" and NOT upcase(strline) like upcase("%https%") */ /* help */
;
quit;
/* Result expected: row 1 and 4 */
... View more