Help using Base SAS procedures

Proc Import: A table with a long name

Reply
Contributor
Posts: 33

Proc Import: A table with a long name

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!

Esteemed Advisor
Posts: 7,092

Proc Import: A table with a long name

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...

Contributor
Posts: 33

Proc Import: A table with a long name

@ 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?

Grand Advisor
Posts: 16,933

Proc Import: A table with a long name

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;

Contributor
Posts: 33

Proc Import: A table with a long name

@ 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?

Grand Advisor
Posts: 16,933

Proc Import: A table with a long name

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;

Occasional Learner
Posts: 1

Re: Proc Import: A table with a long name

[ Edited ]

Hi @Reeza

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

 

Thanks

Grand Advisor
Posts: 16,933

Re: Proc Import: A table with a long name

However you would deal with it in Access since the command is passed to Access.
Ask a Question
Discussion stats
  • 7 replies
  • 1896 views
  • 0 likes
  • 4 in conversation