13.07.2015 Views

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

87CHAPTER10The LIBNAME Statement <strong>for</strong><strong>Relational</strong> <strong>Databases</strong>Overview of the LIBNAME Statement <strong>for</strong> <strong>Relational</strong> <strong>Databases</strong> 87Assigning Librefs 87Sorting Data 87Using <strong>SAS</strong> Functions 88Assigning a Libref Interactively 88LIBNAME Options <strong>for</strong> <strong>Relational</strong> <strong>Databases</strong> 92Overview of the LIBNAME Statement <strong>for</strong> <strong>Relational</strong> <strong>Databases</strong>Assigning LibrefsThe <strong>SAS</strong>/<strong>ACCESS</strong> LIBNAME statement extends the <strong>SAS</strong> global LIBNAMEstatement to enable you to assign a libref to a relational DBMS. This feature lets youreference a DBMS object directly in a DATA step or <strong>SAS</strong> procedure. You can use it toread from and write to a DBMS object as if it were a <strong>SAS</strong> data set. You can associate a<strong>SAS</strong> libref with a relational DBMS database, schema, server, or group of tables andviews. This section specifies the syntax of the <strong>SAS</strong>/<strong>ACCESS</strong> LIBNAME statement andprovides examples. For details about the syntax, see “LIBNAME Statement Syntax <strong>for</strong><strong>Relational</strong> <strong>Databases</strong>” on page 89.Sorting DataWhen you use the <strong>SAS</strong>/<strong>ACCESS</strong> LIBNAME statement to associate a libref withrelational DBMS data, you might observe some behavior that differs from that ofnormal <strong>SAS</strong> librefs. Because these librefs refer to database objects, such as tables andviews, they are stored in the <strong>for</strong>mat of your DBMS. DBMS <strong>for</strong>mat differs from the<strong>for</strong>mat of normal <strong>SAS</strong> data sets. This is helpful to remember when you access and workwith DBMS data.For example, you can sort the observations in a normal <strong>SAS</strong> data set and store theoutput to another data set. However, in a relational DBMS, sorting data often has noeffect on how it is stored. Because you cannot depend on your data to be sorted in theDBMS, you must sort the data at the time of query. Furthermore, when you sort DBMSdata, the results might vary depending on whether your DBMS places data with NULLvalues (which are translated in <strong>SAS</strong> to missing values) at the beginning or the end ofthe result set.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!