08-23-2017 10:30 AM
I have an issue while accessing tables with characters like $ in their names
for example, the below one works well with SAS datasets
proc contents data=abc.'au$co_auth$fc'n;
select * from abc.'au$co_auth$fc'n;
But if abc refers to ORACLE libname, I get error as below
I now get the new error message reading: ERROR: The value 'AU$CO_AUTH$FC'n is not a valid SAS name.
Please help how I can access such datasets. Thanks.
08-23-2017 10:58 AM - edited 08-23-2017 11:28 AM
I think yoi need to havepreserve_tab_names=yes; in your libname statement and then your logic should work or please try something like this below
libname mydblib oracle user=testuser password=testpass
proc sql dquote=ansi;
select * from mydblib."my table";
this was taken from
08-23-2017 10:21 PM - edited 08-23-2017 10:22 PM
first check whether you are able to access other tables in this particular libname. try out explicit pass through also. I would also like to know expert opinion of @LinusH on this topic
08-23-2017 10:50 PM
The PRESERVE_COL_NAMES= and PRESERVE_TAB_NAMES= LIBNAME options determine how SAS/ACCESS Interface to Oracle handles case sensitivity, spaces, and special characters. Please use both of them in LIBNAME. Also, I do not see that you have specified SCHEMA=. SCHEMA= specifies the name that is assigned to a logical classification of objects in a relational database.
08-24-2017 07:33 AM
Thanks @kiranv_. Not sure I can add to what have been already said.
But I can't stop wonder why people make it so complicated. Because you can, it doesn't mean it's a good idea to have table/column names with special/national/space chars etc. If you can't have the DBA rename things, perhaps creating views that comply with SAS naming standards is one way around it.
Assume one way of handling is not to preserve names, and then use _ (haven't tested though).
08-23-2017 11:24 PM
Another option is to use passthru:
proc sql; connect using ORALIB; select * from connection to ORALIB ( select * from CRAZYTABLENAME ); quit;
The stuff between the parentheses is oracle syntax.