OR<column-name>IS
NULL
SQL statement is appended at the end of the SQL
code that is generated for the threaded Read. This ensures that any
possible NULL values are returned in the result set. Also, if the
column to be used for the partitioning is SQL_BIT, the number of threads
are automatically changed to two, regardless of how the DBSLICEPARM=
option is set.
data work.locemp; set trlib.MYEMPS; where EMPNUM<=30 and ISTENURE=0 and SALARY<=35000 and NUMCLASS>2; run;
proc print data=trilib.MYEMPS(DBSLICE=(DSN1="EMPNUM BETWEEN 1 AND 33" DSN2="EMPNUM BETWEEN 34 AND 66" DSN3="EMPNUM BETWEEN 67 AND 100")); run;
datawork.locemp; set trlib2.MYEMP(DBSLICE=("STATE='FL'" "STATE='GA'" "STATE='SC'" "STATE='VA'" "STATE='NC'")); where EMPNUM<=30 and ISTENURE=0 and SALARY<=35000 and NUMCLASS>2; run;
data work.MYEMPS; format HIREDATE mmddyy 0. SALARY 9.2 NUMCLASS 6. GENDER $1. STATE $2. EMPNUM 10.; do EMPNUM=1 to 100; morf=mod(EMPNUM,2)+1; if(morf eq 1) then GENDER='F'; else GENDER='M'; SALARY=(ranuni(0)*5000); HIREDATE=int(ranuni(13131)*3650); whatstate=int(EMPNUM/5); if(whatstate eq 1) then STATE='FL'; if(whatstate eq 2) then STATE='GA'; if(whatstate eq 3) then STATE='SC'; if(whatstate eq 4) then STATE='VA'; else state='NC'; ISTENURE=mod(EMPNUM,2); NUMCLASS=int(EMPNUM/5)+2; output; end; run;
libname trlib odbc user=ssuser pw=sspwd dsn=sspart1; proc datasets library=trlib; delete MYEMPS1;run; run; data trlib.MYEMPS1(drop=morf whatstate DBTYPE=(HIREDATE="datetime" SALARY="numeric(8,2)" NUMCLASS="smallint" GENDER="char(1)" ISTENURE="bit" STATE="char(2)" EMPNUM="int NOT NULL Primary Key CHECK (EMPNUM BETWEEN 0 AND 33)")); set work.MYEMPS; where (EMPNUM BETWEEN 0 AND 33); run; libname trlib odbc user=ssuer pw=sspwd dsn=sspart2; proc datasets library=trlib; delete MYEMPS2;run; data trlib.MYEMPS2(drop=morf whatstate DBTYPE=(HIREDATE="datetime" SALARY="numeric(8,2)" NUMCLASS="smallint" GENDER="char(1)" ISTENURE="bit" STATE="char(2)" EMPNUM="int NOT NULL Primary Key CHECK (EMPNUM BETWEEN 34 AND 66)")); set work.MYEMPS; where (EMPNUM BETWEEN 34 AND 66); run; libname trlib odbc user=ssuer pw=sspwd dsn=sspart3; proc datasets library=trlib; delete MYEMPS3;run; data trlib.MYEMPS3(drop=morf whatstate DBTYPE=(HIREDATE="datetime" SALARY="numeric(8,2)" NUMCLASS="smallint" GENDER="char(1)" ISTENURE="bit" STATE="char(2)" EMPNUM="int NOT NULL Primary Key CHECK (EMPNUM BETWEEN 67 AND 100)")); set work.MYEMPS; where (EMPNUM BETWEEN 67 AND 100); run;
/*SERVER1,SSPART1*/ proc sql noerrorstop; connect to odbc (UID=ssuser PWD=sspwd DSN=SSPART1); execute (drop view MYEMPS) by odbc; execute (create view MYEMPS AS SELECT * FROM users.ssuser.MYEMPS1 UNION ALL SELECT * FROM SERVER2.users.ssuser.MYEMPS2 UNION ALL SELECT * FROM SERVER3.users.ssuser.MYEMPS3) by odbc; quit; /*SERVER2,SSPART2*/ proc sql noerrorstop; connect to odbc (UID=ssuser PWD=sspwd DSN=SSPART2); execute (drop view MYEMPS) by odbc; execute (create view MYEMPS AS SELECT * FROM users.ssuser.MYEMPS2 UNION ALL SELECT * FROM SERVER1.users.ssuser.MYEMPS1 UNION ALL SELECT * FROM SERVER3.users.ssuser.MYEMPS3) by odbc; quit; /*SERVER3,SSPART3*/ proc sql noerrorstop; connect to odbc (UID=ssuser PWD=sspwd DSN=SSPART3); execute (drop view MYEMPS) by odbc; execute (create view MYEMPS AS SELECT * FROM users.ssuser.MYEMPS3 UNION ALL SELECT * FROM SERVER2.users.ssuser.MYEMPS2 UNION ALL SELECT * FROM SERVER1.users.ssuser.MYEMPS1) by odbc; quit;