Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mp_lib2inserts.test.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief Testing mp_ds2inserts.sas macro
4
5 <h4> SAS Macros </h4>
6 @li mf_mkdir.sas
7 @li mp_getddl.sas
8 @li mp_lib2inserts.sas
9 @li mp_assert.sas
10
11**/
12
13/* grab 20 datasets from SASHELP */
14%let work=%sysfunc(pathname(work));
15%let path=&work/new;
16%mf_mkdir(&path)
17libname sashlp "&work";
18proc sql noprint;
19create table members as
20 select distinct lowcase(memname) as memname
21 from dictionary.tables
22 where upcase(libname)="SASHELP"
23 and memtype='DATA'; /* exclude views */
24data _null_;
25 set work.members;
26 call execute(cats('data sashlp.',memname,';set sashelp.',memname,';run;'));
27 if _n_>20 then stop;
28run;
29
30/* export DDL and inserts */
31%mp_getddl(sashlp, schema=work, fref=tempref)
32%mp_lib2inserts(sashlp, schema=work, outref=tempref,maxobs=50)
33
34/* check if it actually runs */
35libname sashlp "&path";
36options source2;
37%inc tempref;
38
39/* without errors.. */
40%mp_assert(
41 iftrue=(&syscc=0),
42 desc=Able to export 20 tables from sashelp using mp_lib2inserts,
43 outds=work.test_results
44)