@Kirito1 wrote:
I was working on SAS and I came to know that we can name our files as today's date using a pre-defined macro. But now I want to name my file as count of observations with file name and todays date. For Example: there were 3445 total observations and I want to keep my filename as Work with todays date.
So, the file name should be = 2023/01/04Work(Total Count = 3445).
The code in which filename was today's date is as follows so that you all can understand what I want. I want the exported file to be named as explained above.
Stick for your filenames to letters, digits and the underscore. Using any other character is just asking for trouble with either SAS, your operating system or both.
Below some code illustrating how this could be done.
data _null_;
call symputx('rowcnt',nobs);
stop;
set sashelp.class nobs=nobs;
run;
proc export
data=sashelp.class
outfile="c:\temp\myfile_&rowcnt._%sysfunc(today(),yymmddn8).csv"
replace
dbms=csv;
run;