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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Data Integrity and Security 4 Potential Result Set Differences When Processing Null Data 31libname myoralib oracle user=testuser password=testpasspath=’myoraserver’ updatelock_type=row;Note: Each <strong>SAS</strong>/<strong>ACCESS</strong> interface supports specific options; see the <strong>SAS</strong>/<strong>ACCESS</strong>documentation <strong>for</strong> your DBMS to determine which options it supports. 4Customizing DBMS Connect and Disconnect ExitsTo specify DBMS commands or stored procedures to run immediately after a DBMSconnection or be<strong>for</strong>e a DBMS disconnect, use the DBCONINIT= and DBCONTERM=LIBNAME options. Here is an example:libname myoralib oracle user=testuser password=testpasspath=’myoraserver’ dbconinit="EXEC MY_PROCEDURE";proc sql;update myoralib.mytable set acctnum=123where acctnum=567;quit;When the libref is assigned, the <strong>SAS</strong>/<strong>ACCESS</strong> engine connects to the DBMS andpasses a command to the DBMS to execute the stored procedure MY_PROCEDURE. Bydefault, a new connection to the DBMS is made <strong>for</strong> every table that is opened <strong>for</strong>updating. There<strong>for</strong>e, MY_PROCEDURE is executed a second time after a connection ismade to update the table MYTABLE.To execute a DBMS command or stored procedure only after the first connection in alibrary assignment, you can use the DBLIBINIT= option. Similarly, the DBLIBTERM=option enables you to specify a command to run be<strong>for</strong>e the disconnection of only the firstlibrary connection, as in the following example:libname myoralib oracle user=testuser password=testpassdblibinit="EXEC MY_INIT" dblibterm="EXEC MY_TERM";Potential Result Set Differences When Processing Null DataWhen your data contains null values or when internal processing generatesintermediate data sets that contain null values, you might get different result setsdepending on whether the processing is done by <strong>SAS</strong> or by the DBMS. Although inmany cases this does not present a problem, it is important to understand how thesedifferences occur.Most relational database systems have a special value called null, which means anabsence of in<strong>for</strong>mation and is analogous to a <strong>SAS</strong> missing value. <strong>SAS</strong>/<strong>ACCESS</strong>translates <strong>SAS</strong> missing values to DBMS null values when creating DBMS tables fromwithin <strong>SAS</strong>. Conversely, <strong>SAS</strong>/<strong>ACCESS</strong> translates DBMS null values to <strong>SAS</strong> missingvalues when reading DBMS data into <strong>SAS</strong>.There is, however, an important difference in the behavior of DBMS null values and<strong>SAS</strong> missing values:3 A DBMS null value is interpreted as the absence of data, so you cannot sort aDBMS null value or evaluate it with standard comparison operators.3 A <strong>SAS</strong> missing value is interpreted as its internal floating-point representationbecause <strong>SAS</strong> supports 28 missing values (where a period (.) is the most commonmissing value). Because <strong>SAS</strong> supports multiple missing values, you can sort a <strong>SAS</strong>missing value and evaluate it with standard comparison operators.

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

Saved successfully!

Ooh no, something went wrong!