Hello Everyone,
We have an SQL Server Database that we would like to load to LASR.
I have some simple questions :
PS : The SAS/ACCESS Interface to SQL Server is not available.
Thank you.
There's no problem with continuing to use OLEDB. If you simply want to copy an SQL Server table into LASR you can automate it like this:
libname MySQLSvr OLEDB <SQLServer connection details>;
%macro Copy_and_Load_LASR ( SQLSrvr_Table = );
* Copy SQL Server table;
proc datasets library = WORK nolist;
delete &SQLSrvr_Table;
run;
copy in = MySQLSvr = out = WORK;
select &SQLSrvr_Table;
run;
quit;
* If table already loaded then delete first.;
proc datasets library = LASRLIB nolist;
delete &SQLSrvr_Table;
run;
quit;
* Now reload latest table.;
data LASRLIB.&SQLSrvr_Table ( &Table_Options. );
set WORK.&SQLSrvr_Table;
run;
* Register or update LASR table in metadata. ;
proc metalib;
omr (library = "LASRLIB");
folder = "/Shared Data/SAS Visual Analytics/Public/LASR";
select = ("&SQLSrvr_Table");
update_rule = (delete);
run;
%mend Copy_and_Load_LASR;
%Copy_and_Load_LASR (SQLSrvr_Table = MySQLSrvrTable1);
%Copy_and_Load_LASR (SQLSrvr_Table = MySQLSrvrTable2);
If you need to select certain columns then you can easily enhance this macro to select them - no SQL required.
There's no problem with continuing to use OLEDB. If you simply want to copy an SQL Server table into LASR you can automate it like this:
libname MySQLSvr OLEDB <SQLServer connection details>;
%macro Copy_and_Load_LASR ( SQLSrvr_Table = );
* Copy SQL Server table;
proc datasets library = WORK nolist;
delete &SQLSrvr_Table;
run;
copy in = MySQLSvr = out = WORK;
select &SQLSrvr_Table;
run;
quit;
* If table already loaded then delete first.;
proc datasets library = LASRLIB nolist;
delete &SQLSrvr_Table;
run;
quit;
* Now reload latest table.;
data LASRLIB.&SQLSrvr_Table ( &Table_Options. );
set WORK.&SQLSrvr_Table;
run;
* Register or update LASR table in metadata. ;
proc metalib;
omr (library = "LASRLIB");
folder = "/Shared Data/SAS Visual Analytics/Public/LASR";
select = ("&SQLSrvr_Table");
update_rule = (delete);
run;
%mend Copy_and_Load_LASR;
%Copy_and_Load_LASR (SQLSrvr_Table = MySQLSrvrTable1);
%Copy_and_Load_LASR (SQLSrvr_Table = MySQLSrvrTable2);
If you need to select certain columns then you can easily enhance this macro to select them - no SQL required.
It worked, Thank you so much !
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.
Find more tutorials on the SAS Users YouTube channel.