Chapter Contents


SAS ODBC Driver User's Guide and Programmer's Reference

Defining Data Libraries

Each data source can include multiple data libraries. (See SAS Data Libraries for information.) Therefore, you provide information about each library that you want to access.

This section describes how to use the Libraries page to define your data libraries. See Defining Libraries at Server Startup Time for information about an alternate way of defining data libraries.

  1. Select the Libraries tab in the SAS ODBC Driver Configuration dialog to go to the Libraries page (Libraries Page). Supply the information described in the following steps. If at any point you want to clear all of the fields on the right side of the dialog and start again, select [Clear].

    Libraries Page


  2. In the Name field, enter a name for an existing physical SAS data library that you want to access. (For those who are familiar with SAS, this field corresponds to the libref in the SAS LIBNAME statement.) The name can be up to eight characters long. The first character must be a letter or an underscore. Subsequent characters can be letters, numeric digits, or underscores. Blanks and special characters are not allowed. For example, you might use the name cost to designate a library of cost-accounting data.

    The SAS data library can include SAS data files, SAS data views, or both. See SAS Data Sets for more information.

    Note:   If you use an ODBC application that exports databases using one-level names, you will need to define a library called user.  [cautionend]

  3. In the Host File field, enter the physical name of the library. This must be a valid pathname for the operating system that your data library is stored on. For example, for a library that is stored on a PC in the Windows environment, c:\data\costacct would be a valid pathname.

  4. (Optional) In the Description field, supply a description of the library, to remind yourself or other users of what the library contains.

  5. (Optional) In the Engine field, enter the name of the SAS engine that is required for writing to and reading from this library. This is necessary only if you do not want the SAS server to use the default engine for the version and release number of the SAS System that you are running. (For Version 8 of the SAS System, the default engine would be V8.) For information about other engines that may be available, see the description of the LIBNAME statement in the SAS Companion for the operating system under which your data library is stored.

  6. (Optional) In the Options field, you may enter the following option for the library that you are defining:
    This option limits users to "read only" access to the SAS data sets in the library.

    Note:   In order to honor this option, the SAS server through which the library is accessed must be running under one of the following releases of the SAS system:(footnote 1)  [cautionend]

  7. Select [<<Add<<] to save your library information. The Library Name is added to the Libraries list at the left.

  8. To include another data library with your data source, repeat steps 2-7.

Defining Libraries at Server Startup Time

Server administrators may prefer to define SAS data libraries at server startup time rather than defining them through the SAS ODBC driver dialogs. Defining libraries at server startup time can make opening the data source faster. It also enables you to avoid hard-coding the physical names of your libraries in your SAS ODBC data-source definitions.

As explained in SAS Servers, the SAS ODBC driver uses a SAS/SHARE server (invoked by PROC SERVER) to access remote data sources. It uses a SAS ODBC server (invoked by PROC ODBCSERV) to access local data sources. To define a data library at server startup time, you precede the PROC SERVER or PROC ODBCSERV statement with a SAS LIBNAME statement. For example, you could define a library of cost-accounting data to a SAS/SHARE server as follows:

libname cost 'e:\fin\acct';
proc server id=acctserv authenticate=optional;

Note:   Depending on the version of the SAS server, the authenticate=optional option may not be needed.  [cautionend]

To define this library to a SAS ODBC server, you would add only the above LIBNAME statement to the !SASROOT\CORE\SASMACRO\SASODBC.SAS file. See Startup Parameters for more information.

When a user requests access to the particular SAS ODBC data source from an ODBC client application, the server would automatically make this library available, along with any libraries that were defined via the SAS ODBC Libraries page.

For more information about the SAS LIBNAME statement, see the SAS Companion for the operating system under which your data library is stored.

Deleting a Data Library Definition

To delete a previously defined data library, do the following:

  1. Select the library name from the Libraries list at the left of the Libraries page (Libraries Page).

  2. Select [>>Remove>>].

Modifying a Data Library Definition

To change the information for a previously defined library, do the following:

  1. Select the library name from the Libraries list on the Libraries page.

  2. Make the desired changes to the Host File, Description, Engine, and Options fields.

  3. Select [<<Update<<] to save your changes.

FOOTNOTE 1:  This option was available with earlier releases, but in the interface that is used by the SAS ODBC driver, this option has been supported only since the stated releases and maintenance levels. [arrow]

Chapter Contents



Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.