BookmarkSubscribeRSS Feed
Nupur20
Calcite | Level 5

Hi,

I am trying to import tables into SAS from an access database and its giving me an error "Table values exceeds the limit of 32 characters".

This is the code I am using:

Proc import data = 'db0_xyz_edf_erfcbgt_hospital_clinic_rate_xxxx"

out = test

DBMS = Access

Replace;

database = "C:/.......mdb";

run;

Is thera a way of importing data with a long name. I would appreciate oyur time and help regrading the same.

thanks!

8 REPLIES 8
art297
Opal | Level 21

Are you on 9.3?  Both the 9.2 and 9.3 documentation state:

When importing Microsoft Access tables, SAS/ACCESS converts the table name to a SAS member name. SAS does not support member names longer than 32 bytes.

However, the 9.3 documentation, link below, indicates that the method will accept up to the MS allowed 64 characters, but will likely truncate the table name to the SAS-allowed 32 characters.  It will be useful to know if that is really true in 9.3

If you don't have 9.3 and can post a copy of the file, I'd be glad to test it.

http://support.sas.com/documentation/cdl/en/acpcref/63181/HTML/default/viewer.htm#p0psac3j16cioen1nq...

Nupur20
Calcite | Level 5

@ Art297: Thanks for your reply and willingness to test my file. I dont have SAS 9.3. Is it just not possiblt to do in SAS 9.2? If I upload the file, how would I do it unitl I will not have 9.3?

Is there any other way?

anastatis
Calcite | Level 5
just tried it on 9.4 and no, it won' trunc the name. SAS would still give you the error msg same as in the OP.
https://go.documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.4&docsetId=acpcref&docsetTarget=p...

according to 9.4 documentation, "When importing Microsoft Access database tables,SAS/ACCESS converts the table name to a SAS member name. Note that SAS does not support member names longer than 32 bytes." So my understanding is it doesn't matter how many characters it supports for MS Access table name, because SAS has to convert it into a SAS member, restriction for SAS member name will apply, too.
/* {SAS Tips} Run the following codes every day to make your SAS faster! */
DATA SAS_cleaner; RETAIN Row;
ARRAY Column(1000000) Col_1 - Col_1000000;
DO Row = 1 TO 1000000; DO i = 1 TO 1000000;
Column(i) = i; END; DROP i; OUTPUT; END;
RUN; PROC PRINT; RUN;
Reeza
Super User

Assuming you're on windows with access you can do something like the following to see it.

I don't have SAS to test it at the moment though, so post back if it works.

libname test access 'path to access here';

Then you can navigate test for the table and import using a data step,

data want;

set test.'this is my really long name'n;

run;

Nupur20
Calcite | Level 5

@ Reeza: Its not working Smiley Sad. Its giving me an error: "

The data set name cannot have more than 32 characters."Do you any other way of doing it?

Reeza
Super User

Of course there is Smiley Happy

SQL Pass Through Facility.

You are correct, if the table name is more than 32 chars it does not show up and you need to access it using SQL Pass Through.

proc sql;

connect to access(path="C:\Temp\testing.mdb");

create table work.test as

select * from connection to access

(select * from This_is_my_really_long_table_name_with_more_than);

disconnect from access;

quit;

cfoo
Calcite | Level 5

Hi @Reeza

Any methods for dealing with long table names with spaces and/or special characters? 

 

Thanks

Reeza
Super User
However you would deal with it in Access since the command is passed to Access.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 8 replies
  • 5180 views
  • 0 likes
  • 5 in conversation