(Logically) concatenated libraries
libname tq84_d1 'p:\ath\to\directory\one';
libname tq84_d2 'p:\ath\to\directory\two';
libname tq84_d3 'p:\ath\to\directory\three';
%macro create_tab(lib_no,nam);
create table tq84_d&lib_no..&nam(
col_1 numeric,
col_2 char(10)
);
insert into tq84_d&lib_no..&nam values(&lib_no,"&nam");
%mend;
proc sql;
%create_tab(1,foo);
%create_tab(2,bar);
%create_tab(3,baz);
quit;
/*
Create a concatenated library (tq84_all). With this library, it is possible
to access tables in different libraries (and locations) with a single libref.
*/
libname tq84_all (
tq84_d1,
tq84_d2,
tq84_d3
);
proc sql;
/*
The following view is created in the
tq84_d1 library.
*/
create view tq84_all.foo_bar_baz as
select * from tq84_all.foo union all
select * from tq84_all.bar union all
select * from tq84_all.baz;
quit;
proc sql;
select * from tq84_all.foo_bar_baz;
quit;
Connecting to a Server
Using the server
option to connect to a remote host/server:
%let tq84_srv=host.renenyffenegger.ch 5105;
options comamid=tcp;
options netencrypt
netencryptalgorithm=SASProprietary;
signon tq84_srv
noscript
user=tq84
password="{SAS002}5D71C73D177DE3AB1488316D52BDEBDE1ADDF998";
libname tq84_lib "abc.defghi.jklmno.sasdb"
server = tq84_srv
disp = shr;
proc sql;
select * from tq84_lib.foo_bar;
quit;
libname tq84_lib clear;