Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mp_testwritespeedlibrary.sas
Go to the documentation of this file.
1/**
2 @file mp_testwritespeedlibrary.sas
3 @brief Tests the write speed of a new table in a SAS library
4 @details Will create a new table of a certain size in an
5 existing SAS library. The table will have one column,
6 and will be subsequently deleted.
7
8 %mp_testwritespeedlibrary(
9 lib=work
10 ,size=0.5
11 ,outds=work.results
12 )
13
14 @param [in] lib= (WORK) The library in which to create the table
15 @param [in] size= (0.1) The size in GB of the table to create
16 @param [out] outds= (WORK.RESULTS) The output dataset to be created.
17
18 <h4> SAS Macros </h4>
19 @li mf_getuniquename.sas
20 @li mf_existds.sas
21
22 @version 9.4
23 @author Allan Bowe
24
25**/
26
27%macro mp_testwritespeedlibrary(lib=WORK
28 ,outds=work.results
29 ,size=0.1
30)/*/STORE SOURCE*/;
31%local ds start;
32
33/* find an unused, unique name for the new table */
34%let ds=%mf_getuniquename();
35%do %until(%mf_existds(&lib..&ds)=0);
36 %let ds=%mf_getuniquename();
37%end;
38
39%let start=%sysfunc(datetime());
40
41data &lib..&ds(compress=no keep=x);
42 header=128*1024;
43 size=(1073741824/8 * &size) - header;
44 do x=1 to size;
45 output;
46 end;
47run;
48
49proc sql;
50drop table &lib..&ds;
51
52data &outds;
53 _start=&start;
54 _end=datetime();
55 lib="&lib";
56 start_dttm=put(_start,datetime19.);
57 end_dttm=put(_end,datetime19.);
58 /* both timestamps above are text, so the difference has to come from the
59 numeric values - subtracting the strings yields a missing value */
60 duration_seconds=_end-_start;
61 drop _start _end;
62run;
63
64%mend mp_testwritespeedlibrary;