I have a situation were I need to output my datasets in CSV files with system timestamp. What is the best way to do so? Currently I'm doing a separate macro var to store date from sysdate and then HH and MM from SYStime separately and then combining all three together into an other macro var and then using the same in the outfile of the PROC EXPORT..
Since you want to generate the date/time as part of your program, the technique using macro variable is reasonable - it also can be done with a DATA step and use CALL SYMPUT to generate the macro variable as needed (format-wise). Here's just one example using macro variables:
The characters often used in formatted date time values are not usually welcome in filenames. I like to use a PICTURE format to format the date time exactly as I want. Use the PICTURE in the format field of SYSFUNC call to DATATIME. Make sure the default width is correct so there will be no leading spaces.