SAS organizes tables
in libraries. Before you can use a SAS library, you must tell SAS
where it is. One way to identify the library is to use a libref, which
is a short name (or alias) for the full physical name of the library.
In the SAS programming language, you use a LIBNAME statement in order
to define the libref. In your Java application, you use the librefs
connection property in order to assign the SAS library.
For example, you have
a Base SAS data set named
suppliers.sas7bdat
that is stored in a directory named
c:\sasdata
on a SAS Workspace Server. The following line of code shows how
you set the librefs connection property in order to define mySasLib.
props.setProperty("librefs", "mySasLib 'c:\\sasdata'");
Often, librefs are already
defined for SAS servers, which means you do not need to set the librefs
property.
You write your Java
application using standard SQL. However, you must prepend a libref
to the name of the table that you want to access. For example, after
you define mySasLib, you can issue the following query in order to
access the data in
suppliers.sas7bdat
.
String queryString = "SELECT * FROM mySasLib.suppliers";
For more information
about SAS libraries, librefs, and the LIBNAME statement, see
SAS Language Reference: Dictionary.
Note: For information about how
to access a Base SAS data set without using a LIBNAME statement, see
“SAS Libraries: Tools for Managing Libraries” in
SAS Language Reference: Concepts.