Specifies a key column to optimize DBMS retrieval. Can improve performance when you are processing a join that involves a large DBMS table and a small SAS data set or DBMS table.
Valid in: | DATA and PROC steps |
Supports: | All |
used by SAS to build an internal WHERE clause to search for matches in the DBMS table based on the key column. For example:
select * from sas.a, dbms.b(dbkey=x) where a.x=b.x;
x
, which matches the key
column designated in the WHERE clause. However, if the DBKEY= column
does not match the key column in the WHERE clause, then DBKEY= is
not used.
libname invty fedsvr server="d1234.us.company.com" port=2171 user=user1 pwd=pass1 dsn=db2dsn dsnuser=db2user dsnpwd=db2pwd; data invty.stock; set addinv; modify invty.stock(dbkey=partno) key=dbkey; INSTOCK=instock+nwstock; RECDATE=today(); if _iorc_=0 then replace; run;
options sastrace=',,,d' sastraceloc=saslog nostsuffix; proc sql; create table work.barbkey as select keyvalues.empid, employees.hiredate, employees.jobcode from mydblib.employees(dbkey=(empid jobcode)) inner join work.keyvalues on employees.empid = keyvalues.empid; quit;