DATA Step, Macro, Functions and more

Import long field from MS Access - data is truncating

Accepted Solution Solved
Reply
Contributor
Posts: 54
Accepted Solution

Import long field from MS Access - data is truncating

I'm trying to get data from an Access 2007 database. The field is text and can be 2000 characters long.

SAS is truncating the field to 1024 chars.

What is the correct way of importing this table so that the field length is preserved?

What I'm doing now is creating a libname using odbc to connect to the Access db.

When I "View Columns" in the table in Explorer window in SAS for the Access library, it shows the length of the field as 1024.


Accepted Solutions
Solution
‎07-12-2012 11:16 AM
Respected Advisor
Posts: 4,937

Re: Import long field from MS Access - data is truncating

Use the Access Engine as in :

libname ac Access "myDatabase.accdb" DBMAX_TEXT=2048;

from SAS doc:

DBMAX_TEXT= integer between 1 and 32,767

specifies the maximum length for a character string. Character strings longer than 32,767 are truncated. This option only applies when you are reading, appending, and updating character data in a Microsoft Access database or Microsoft Excel workbook from SAS.

Default:1,024

PG

PG

View solution in original post


All Replies
Solution
‎07-12-2012 11:16 AM
Respected Advisor
Posts: 4,937

Re: Import long field from MS Access - data is truncating

Use the Access Engine as in :

libname ac Access "myDatabase.accdb" DBMAX_TEXT=2048;

from SAS doc:

DBMAX_TEXT= integer between 1 and 32,767

specifies the maximum length for a character string. Character strings longer than 32,767 are truncated. This option only applies when you are reading, appending, and updating character data in a Microsoft Access database or Microsoft Excel workbook from SAS.

Default:1,024

PG

PG
Contributor
Posts: 54

Re: Import long field from MS Access - data is truncating

Excellent. Thank you.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 302 views
  • 0 likes
  • 2 in conversation