Download presentation
Presentation is loading. Please wait.
Published byBenedita Flores Modified over 5 years ago
1
Adding and modifying the SAS Macro SYSDATE to output files
M. Scot Fague Sr. Database Analyst Division of Biostatistics - Washington University
2
Automatic Macro variables are those variables that are invoked automatically when a SAS job or session is started. Date (SYSDATE or SYSDATE9) character value representing the date SYSDATE uses the two-digit year (i.e., 11NOV15) %put My SAS Session started on: &sysdate (two-digit year); My SAS Session started on: 09NOV15 (two-digit year) SYSDATE9 uses the four-digit year (i.e., 11NOV2015) %put My SAS Session started on: &sysdate9 (four-digit year); My SAS Session started on: 09NOV2015 (four-digit year) Day (SYSDAY) day of the week (i.e., Wednesday) %put My SAS Session started on this day of the week: &sysday; My SAS Session started on this day of the week: Monday Time (SYSTIME) the time (24 hr) (i.e., 14:30) %put My SAS Session started at this time of day: &systime (24 hour format); My SAS Session started at this time of day: 10:57 (24 hour format)
3
Date Day of the Week Current Time
timeAmPm8.0 Creating Current macros for date, day and time are easy and may be preferred. Especially if a batch job, or session, may run over night, or if you are interested in version output. The date and time the code was invoked can be captured: Date %Put The date today is: %sysfunc(date(),date9.); The date today is: 09NOV2015 Day of the Week %Put The day of the week is: %sysfunc(date(),downame9.); The day of the week is: Monday Current Time %Put Current Time is: %sysfunc(time(),timeAmPm8.0); Current Time is: 6:29 PM
4
Adding the date to: Filename DataFile
ODS PDF FILE= "C:\Users\scot.BIOSTAT\SYSDATE_EXAMPLE\MyOUTPUT_&sysdate9..PDF“; DataFile Data MyLib.MyData_&sysdate9; Set A; Run;
5
Thank You
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.