Before you use the IMPORT
and the EXPORT procedures for Access files, it is helpful to be familiar
with Access file formats. For an existing .mdb file, you can specify
DBMS=ACCESS on Windows platforms, and SAS identifies the version.
-
Access 2000, 2002, and 2003 share
the same .mdb file formats. ACCESS2000, ACCESS2002, and ACCESS2003
are treated as aliases for Access in SAS.
-
Access 2007 supports .accdb file
formats.
IMPORT and EXPORT Procedure Statements for Access Files on
Windows
|
|
|
|
|
|
|
|
Complete path and filename
for the Microsoft Access database file.
|
|
|
|
|
Any valid data set options
for Microsoft Access database engine.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Complete path and filename
for the Workgroup Administration file.
|
|
|
|
On Linux, UNIX, and
Microsoft Windows operating platforms, you can use the client/server
model to access data in .mdb files and .accdb files. For more information,
see
PC Files Server Administration.
For an existing .mdb
you can specify DBMS=ACCESSCS when using the client/server model and
SAS identifies the version of Access for you. You can specify VERSION
= '97' when using the client/server model only when you want to export
and create a new .mdb file with Access version 97 formats.
Note: If the client/server model
is used, the SAS client cannot access an Access database file with
both database password protection and user level security protection.
In this case, you must choose only one security protection to be able
to access your Access database file from a SAS client.
The following table
lists the statements to import or export data to or from an Access
database file using the client/server model. The statements are valid
on Linux, UNIX, and Microsoft Windows operating platforms.
IMPORT and EXPORT Procedure Statements for Access Files When
Using PC Files Server
|
|
|
|
|
|
|
|
Complete path and filename
for the Microsoft Access database file.
|
|
|
|
|
Any valid data set options
for Microsoft Access database engine.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Complete path and filename
for the Workgroup Administration file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 | 2000 | 2002 | 2003
| 2007 | 2010
|
|
|
|
- DATABASE= database
-
specifies the complete
path and filename of the Access database file that contains the specified
DBMS table. If the database name does not contain lowercase characters,
special characters, or national characters ($, #, or @), you can omit
the quotation marks.
Note: SAS does not generate a default value, but you can configure
one in the DBMS client software.
- DBDSOPTS= data set options that are valid
for the Access database LIBNAME engine
-
Enables you to take
advantage of useful data set options for the LIBNAME engine such as
READBUFF= , INSERTBUFF= , DBTYPE=, DROP= , FIRSTOBS= , and OBS=. This
option is for advanced users who are familiar with the PC files LIBNAME
engine.
Requirements:You must surround the options in single quotation marks.
/* Example of correct use */
DBDSOPTS=’FIRSTOBS=10 READBUFF=25’;
If the option string that you are specifying contains
single quotation marks, you must use double quotation marks around
it in your statement.
/*Example of correct use */
DBDSOPTS="DBTYPE=(BilledTo=’CHAR(8)’)";
Notes:For users who use the client/server model to access data
in an Access database, the default value for READBUFF= is 1. To improve
performance for reading data, you should set the READBUFF= option
to 25 or higher.
For users who use the client/server model to access data
in an Access database, the default value for INSERTBUFF= is 1. To
improve performance for reading data, you should set the INSERTBUFF=
option to 25 or higher.
- DBPASSWORD= database-file-password
-
enables you to access
a file if database-level security is set in the .mdb file. This option
enables you to access .mdb and .accdb files with passwords, but it
does not allow you to create .mdb and .accdb files with passwords
included. A database password is case sensitive. You can define a
database password instead of user-level security.
- DBSASLABEL= COMPAT | NONE | YES | NO
-
specifies the data
source for column names.
COMPAT specifies
that the data source column headings are saved as the corresponding
SAS label names.
NONE specifies
that the data source column headings are not saved as SAS label names.
The SAS label names are then left as blanks.
Aliases: YES (for COMPAT)
NO (for NONE)
Restrictions: Due to a Microsoft Jet engine limitation, no more than
64 characters of column names are written to SAS variable labels.
Due to a limitation in the Microsoft Ace engine and
the Microsoft Jet Excel engine, using MIXED=YES could result in improper
text variable lengths.
- DBSYSFILE= complete path and filename
for the Workgroup Administration file
-
specifies the location
of the Workgroup Administration file. You might have defined this
file, which contains information about the users in a Workgroup, for
your Microsoft Access database.
Alias: WGDB
Note: When you install Microsoft Access, the Setup program
automatically creates a Microsoft Access Workgroup information file
that is identified by the name and organization information that you
specify. Because this information is often easy to determine, it is
possible for unauthorized users to create another version of this
Workgroup Information file and assume the irrevocable permissions
of an administrator account (a member of the Admins group) in the
Workgroup defined by that Workgroup Information file. To prevent this,
create a new Workgroup Information file and specify a Workgroup ID
(WID). Only someone who knows the WID can create a copy of the Workgroup
Information file. Any user and group accounts or passwords that you
create are saved in the new Workgroup Information file.
- MEMOSIZE= 1 to 32767
-
Specifies the maximum
variable length in SAS that is allowed while importing data from memo
columns of an Access database table. Any memo data in an Access database
tables whose length exceeds 32767 is truncated when it is imported
into SAS.
Alias: DBMAX_TEXT
Restriction: If the maximum length that SCANMEMO = option is greater
than the value of the MEMOSIZE= option, the smaller value in the MEMOSIZE
= option is applied as the SAS variable width.
- PORT= port-number
-
specifies the number
of the port that is listening on the PC Files Server. The valid value
is between 1 and 65535. This port or service name displays on the
PC Files Server display when the application is started in server
mode.
Alias: PORT_NUMBER
Default: 9621
Restrictions: Available only for the client/server model.
The PORT= statement option and the SERVICE= statement
option should not be used in the same procedure.
- SCANMEMO= YES | NO
-
specifies whether to
scan the memo data to determine the column length for each memo-type
source column.
YES scans
the length of memo data for a data source column. Uses the length
of the longest memo text of data that it finds, as the SAS variable
width.
NO does
not scan the length of memo data for a data source column. The column
length returned from the Microsoft Ace engine or the Microsoft Jet
engine is used as the SAS variable length.
Restrictions:When SCANMEMO=YES, if the maximum length that SCANMEMO
= option is greater than the value of the MEMOSIZE= option, the smaller
value in the MEMOSIZE = option is applied as the SAS variable width.
SCANMEMO = does not apply to text type columns. This
option applies only to memo data type columns.
- SCANTIME= YES | NO
-
specifies whether to
scan the date/time data while importing data from a date/time column
from an Access database.
YES scans
the date/time column and assigns the TIME. format for a date/time
column only if time values are found in the column.
NO specifies
not to scan the date/time column.
Interactions: The DATE9. format is assigned for a date/time
column if USEDATE= YES.
The DATETIME. format is assigned for a date/time
column if USEDATE= NO.
- SERVER= PC-Files-Server-name
-
specifies the name
of the PC Files Server, where PC-Files-Server-name can
be either the computer name or the associated IP address. You must
bring up the listener on the PC Files Server before you can establish
a connection to it. You can also configure these items:
-
-
-
the maximum number of concurrent
connections
-
specifications to indicate whether
data encryption will be used
Alias: SERVER_NAME
Restriction: Available only for the client/server model.
Note: You can omit this option if you are running SAS and
the PC Files Server on the same machine. Omitting this option under
this condition causes the PC Files Server to start automatically in
the background.
- SERVERPASS= server-user-password
-
specifies the password
for the User ID given. If the account has no password, omit this option.
Always enclose the value in quotes. This preserves the case of the
password.
Alias: SERVERPASSWORD | SERVERPW | SERVERPWD
Notes: Passwords are generally case sensitive.
Use the PASSWORD= option for database passwords.
Example: LIBNAME example using explicit user name and password
for PC Files Server:
LIBNAME DB PCFILES PATH='C:\myfile.mdb'
SERVER=fileserv;
SERVERUSER='mydomain\myusername';
SERVERPASS='mypassword';
RUN;
- SERVERUSER= server-user-name
-
specifies a domain
and user ID that is valid for the PC running PC Files Server. Always
enclose the value in quotes. Otherwise, the backslash can be misinterpreted
by the SAS parser.
Alias: SERVERUID
Notes: If you are not on a domain, omit the domain name and
the backslash.
Use the USER= option for database User IDs.
Example: LIBNAME using explicit user name and password, for
PC Files Server:
LIBNAME DB PCFILES PATH='C:\myfile.mdb'
SERVER=fileserv;
SERVERUSER='mydomain\myusername';
SERVERPASS='mypassword';
RUN;
- SERVICE= service-name
-
specifies the service
name that is defined on your service file for your client and server
machines. This port number or service name is displayed on the PC
Files Server control panel screen when it is started on the PC in
server mode.
Alias: SERVICE_NAME
Restrictions:Available only for client/server model.
Do not use this statement and the PORT= statement option
in the same procedure.
Note: This service name needs to be defined on both your UNIX
machine and your PC Files Server.
- SSPI= YES | NO
-
enables PC Files Server
to allow Integrated Windows Authentication. This is a mechanism for
Windows client and server to exchange credentials.
Default: NO
Restriction: Valid only on Windows 64-Bit.
Note: SSPI can also be enabled by specifying the –SSPI
option on the SAS command line.
Example: LIBNAME using SSPI:
LIBNAME DB PCFILES PATH='C:\myfile.mdb'
SERVER=localhost;
SSPI = 'yes';
RUN;
- USEDATE= YES | NO
-
specifies whether to
assign a DATE. or a DATETIME. format while importing a date/time column
from a Microsoft ACCESS workbook.
YES assigns
the DATE. format for the corresponding date/time column in the Microsoft
ACCESS table. See the SCANTIME = option to assign the appropriate
TIME format.
NO assigns
the DATETIME. format for the corresponding date/time column in the
Microsoft ACCESS table.assigns the DATETIME. format for the corresponding
date/time column in the Microsoft ACCESS table.
- VERSION= file-version
-
specifies the version
of the file that you want to create. Valid values are 2007, 2003,
2002, 2000, and 97. The default value depends on the extension of
the file. Always surround the version value with single quotation
marks.
Restriction:Available only for client/server model.
Interaction:If the file exists on the PC Files Server, then
the statement is ignored.