Excempel på SAS-trace LIBNAME my_db1 ODBC LIBNAME my_db2 ODBC DATASRC=my_db1 DATASRC=my_db2 USER=SASABMDBUser USER=SASABMDBUser PASSWORD="Orion123" ; PASSWORD="Orion123" ; options sastrace=',,,d' nostsuffix sastraceloc=saslog; proc datasets lib=my_db1 nolist; delete class; run; data my_db1.class; set sashelp.class; run; options sastrace=off; ****************************************************************************** * * Exempel på join över två databaser i samma datbas, men med olika libnames * ****************************************************************************** *; LIBNAME my_db1 ODBC DATASRC=my_db1 USER=SASABMDBUser PASSWORD="Orion123" ; LIBNAME my_db2 ODBC DATASRC=my_db2 USER=SASABMDBUser PASSWORD="Orion123" ; options sastrace=',,,d' nostsuffix sastraceloc=saslog; proc sql ; create table my_classes as select c1.* from my_db1.class c1 inner join my_db2.class c2 on c1.name = c2.name; quit; options sastrace=off; options sastrace=',,,d' nostsuffix sastraceloc=saslog; proc sql; connect to odbc (DATASRC=my_db1 USER=SASABMDBUser PASSWORD="Orion123"); create table pass_through_class as select * from connection to odbc (select c1.* from dbo.class c1 inner join my_db2.dbo.class c2 on c1.name = c2.name ); disconnect from odbc; quit; options sastrace=off; libname my_views 'D:\Views'; options sastrace=',,,d' nostsuffix sastraceloc=saslog; proc sql noprint; connect to odbc (DATASRC=my_db1 USER=SASABMDBUser PASSWORD="Orion123"); create view my_views.pass_through_class as select * from connection to odbc (select c1.* from dbo.class c1 inner join my_db2.dbo.class c2 on c1.name = c2.name ); disconnect from odbc; quit; options sastrace=off; options sastrace=',,,d' nostsuffix sastraceloc=saslog; data view_join; set my_views.pass_through_class; run; options sastrace=off; ****************************************************************************** **; * Exempel på temporära tabeller (MS SQL Server) *; ****************************************************************************** ***; LIBNAME my_db2 ODBC connection=shared; DATASRC=my_db2 USER=SASABMDBUser options sastrace=',,,d' nostsuffix sastraceloc=saslog; data my_db2.'#males'n; set sashelp.class; where Sex = 'M'; run; proc sql ; create table males as select * from my_db2.class where name in (select name from my_db2.'#males'n); quit; options sastrace=off; PASSWORD="Orion123"