As the first step in the decommissioning of the site has been converted to read-only mode.

Here are some tips for How to share your SAS knowledge with your professional network.

Using Sysfunc to date-stamp data set names

From sasCommunity
Jump to: navigation, search

Using Sysfunc to date-stamp a data set

This programs shows how to use sysfunc with other date and datetime functions to create macro variables with values to use when you want to date-stamp a data set.

%let datepart  = %sysfunc(datepart(%substr(&SysProcessId.,1,16)x));
%let year      = %sysfunc(year(&Datepart.));
%let Julian7   = %sysfunc(putn(&Datepart.,julian7.));
%let ddd       = %substr(&Julian7.,5,3);
%let month     = %sysfunc(putn(&Datepart.,month2.));
%let month     = %sysfunc(putn(&Month.,z2.));
%let day       = %sysfunc(putn(&Datepart.,day3.));
%let day       = %sysfunc(putn(&Day.,z2.));
%let monthname = %sysfunc(putn(&Datepart.,monname3.));
%*Put Jobs&Year._&Month.&MonthName.;
%put _user_;
<source lang="sas">

Here is my application, which appends daily data sets to a monthly accumulative data set.

Proc Append base = SASlogs.Jobs&Year._&Month.&MonthName.
            data = JobTime;

... and the log:

NOTE: There were 1 observations read from the data set WORK.JOBTIME.
NOTE: The data set SASLOGS.JOBS2007_08AUG has 1 observations and 14 


-- created by User:Rjf2 16:08, 13 August 2007 (EDT)

--Ronald_J._Fehd macro.maven == the radical programmer