Specifies whether backslashes in literals are preserved during data copy from a SAS data set to a table.
| Valid in: | DATA and PROC steps (when accessing DBMS data using SAS/ACCESS software) |
|---|---|
| Category: | Data Set Control |
| Default: | NO |
| Data source: | MySQL |
| See: | ESCAPE_BACKSLASH= LIBNAME option |
Table of Contents
specifies that an additional backslash is inserted in every literal value that already contains a backslash.
specifies that backslashes that exist in literal values are not preserved. An error results.
MySQL uses the backslash as an escape character. When data that is copied from a SAS data set to a MySQL table contains backslashes in literal values, the MySQL interface can preserve them if ESCAPE_BACKSLASH=YES.
In this example, SAS
preserves the backslashes for x and y values.
libname out mysql user=myusr1 pw=mypwd1
server=striper database=test port=3306;
data work.test;
length x y z $10;
x = "ABC";
y = "DEF\";
z = 'GHI\';
run;
data out.test(escape_backslash=yes);
set work.test;
run;
The code successfully generates this INSERT statement.
INSERT INTO 'test' ('x','y','z') VALUES ('ABC','DEF\\','GHI\\')
For the prior example, here is the error that is displayed if ESCAPE_BACKSLASH=NO.
ERROR: Execute error: You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the
right syntax to use near 'GHI\')' at line 1