If you are creating multiple datasets in SAS, you may wish to name them in an automated manner. The code below demonstrates how to create a filename that is based on the date and timestamp. Such a file naming process will 1) prevent you from giving the same filename to two different datasets and 2) allow you to see when files were first created.
The code below presents an example. We first generate a dataset to be saved, tsave. Then, we use another data step to create the string that we will use to name the files and save it as a macro variable "mytime". Then, in the last data step, we refer to the macro variable "mytime" in naming the saved dataset.
data tsave; do i = 1 to 10; do time = 1 to 5; y = rannor(1232+i + time); output; end; end; run;data _null_; cdate = "&SYSDATE9"; ctime = "&SYSTIME"; time_string = cdate||"_"||translate(ctime, "_", ":"); call symput('mytime', time_string); run;data "c:tempnewdata_&mytime"; set tsave; run;