Production Ready Macros for SAS Application Developers
https://github.com/sasjs/core
mf_uid.sas
Go to the documentation of this file.
1 /**
2  @file
3  @brief Creates a Unique ID based on system time in a friendly format
4  @details format = YYYYMMDD_HHMMSSmmm_<sysjobid>_<3randomDigits>
5 
6  %put %mf_uid();
7 
8  @version 9.2
9  @author Allan Bowe
10 
11 **/
12 
13 %macro mf_uid(
14 )/*/STORE SOURCE*/;
15  %local today now;
16  %let today=%sysfunc(today(),yymmddn8.);
17  %let now=%sysfunc(compress(%sysfunc(time(),time12.3),:.));
18 
19  &today._&now._&sysjobid._%sysevalf(%sysfunc(ranuni(0))*999,CEIL)
20 
21 %mend;