BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
kjohnsonm
Lapis Lazuli | Level 10

Hello all,

I see a few topics here on escape character but am not sure they work for proc sql or maybe I am doing somting wrong... 

example string:

Y:\mydir\mysubdir\myfile.txt

Y:\mydir2\mysubdir\myfi%le.txt

 

 

proc sql;
create table list_of_maybe_bad as
select
        Path_File,
        length(Path_File) as lh_Path_File,
        trimn(Path_File) as Path_File1,  
/*...*/
from list_of_working
where upcase(Path_File) not like "D:\SOFTWARE\%"    /* Do not search our Software repostitory */
and Path_File like '%\%%'
;
quit;

In my case i need to return just the second file.   I have tryied '%%%'      '%\%%'     '%/%%'   TIA.

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

According to the documentation, you can choose your own escape character (i.e. ideally a character which does definitely not occur in the strings you work with): If '^' was such a character, the WHERE condition

Path_File like '%^%%' escape '^'

would match any string which contains a percent sign.

 

View solution in original post

2 REPLIES 2
FreelanceReinh
Jade | Level 19

According to the documentation, you can choose your own escape character (i.e. ideally a character which does definitely not occur in the strings you work with): If '^' was such a character, the WHERE condition

Path_File like '%^%%' escape '^'

would match any string which contains a percent sign.

 

kjohnsonm
Lapis Lazuli | Level 10

I see I should have been looking up like...  Thank you.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 9718 views
  • 2 likes
  • 2 in conversation