Macros for SAS Application Developers
https://github.com/sasjs/core
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 
41 data &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;
47 run;
48 
49 proc sql;
50 drop table &lib..&ds;
51 
52 data &outds;
53  lib="&lib";
54  start_dttm=put(&start,datetime19.);
55  end_dttm=put(datetime(),datetime19.);
56  duration_seconds=end_dttm-start_dttm;
57 run;
58 
59 %mend mp_testwritespeedlibrary;