Skip to content

Instantly share code, notes, and snippets.

@statgeek
Last active July 31, 2019 15:41
Show Gist options
  • Select an option

  • Save statgeek/ca1906c14c0597a8cf7e225c3636bc4d to your computer and use it in GitHub Desktop.

Select an option

Save statgeek/ca1906c14c0597a8cf7e225c3636bc4d to your computer and use it in GitHub Desktop.
SAS - datetime stamp for filenames
*This illustrates how to create a datetime stamp in the format of YYYYMMDDHHMM;
%let fileTimeStamp = %sysfunc(date(), yymmddn8.)%sysfunc(putc(%sysfunc(time(), b8601TM6.), $4.)) ;
%put &fileTimeStamp.;
*Results from log;
* 71 %let fileTime = %sysfunc(date(), yymmddn8.)%sysfunc(putc(%sysfunc(time(), b8601TM6.), $4.)) ;
* 72 %put &fileTime.;
* 201907310938;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment