Data Set Options for Relational Databases |
Specifies whether backslashes
in literals are preserved during
data copy from a SAS data set to a table.
Default value: |
NO
|
Valid in: |
DATA and PROC steps (when accessing DBMS data
using SAS/ACCESS software)
|
DBMS support: |
MySQL
|
ESCAPE_BACKSLASH=YES | NO
|
- YES
-
specifies that an additional backslash is inserted in every
literal value that already contains a backslash.
- NO
-
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=dbitest pw=dbigrp1
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\\')
If ESCAPE_BACKSLASH=NO instead in this example, this error displays:
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
To assign this option to a group of relational DBMS tables
or views, see the ESCAPE_BACKSLASH= LIBNAME Option.
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.