Download presentation
Presentation is loading. Please wait.
Published byGwendoline Summers Modified over 9 years ago
1
MASUG March 10, 2006 at FedEx
2
Agenda Announcements Announcements Tips & Tricks Tips & Tricks Lisa Horwitz from SAS Lisa Horwitz from SAS
3
Announcements Next meeting May 2006 Next meeting May 2006 –Hopefully at the Doubletree on Sanderlin with beverages and snacks (tentative 5-7 pm) –SESUG speaker topic choice SAS training in Memphis SAS training in Memphis –SAS makes go/no go decision 3 weeks before class date so register early! –New location in FedEx Institute of Technology
4
Announcements (cont’d) Volunteers for Planning Committee? Volunteers for Planning Committee? –No experience needed and no compensation provided –No experience needed and no compensation provided SUGI March 26-29 SUGI March 26-29 –Get together at the Kickback Party? SESUG October 8-9 in Atlanta SESUG October 8-9 in Atlanta –Call for Papers closes April 7th
5
Complete Automation of Routine Reports Using Macro Variables Memphis Area SAS Users Group Friday, March 10, 2006 Michael Bates, Risk Analyst First Horizon National Corporation (901) 257-6038 mwbates@firsthorizon.com
6
Goal Submit a routine SAS job, in a open session or in a scheduled queue, with no user input needed Why ? Eliminate user error Easily pass reports on to others
7
Determining Appropriate Time Frame Today’s DateLog %let tdy = %sysfunc(today());1 %let tdy = %sysfunc(today()); %put tdy = &tdy.; 2 %put tdy = &tdy.; tdy = 16862 This YearLog %let mnth = %sysfunc(month(&tdy.));3 %let mnth = %sysfunc(month(&tdy.)); %put mnth = &mnth.;4 %put mnth = &mnth.; mnth = 3 This MonthLog %let yr = %sysfunc(year(&tdy.));5 %let yr = %sysfunc(year(&tdy.)); %put yr = &yr.;6 %put yr = &yr.; yr = 2006 This WeekLog %let wk = %sysfunc(week(&tdy.));7 %let wk = %sysfunc(week(&tdy.)); %put wk = &wk.;8 %put wk = &wk.; wk = 9 Last MonthLog %let l_mnth = %eval(&mnth. - 1);9 %let l_mnth = %eval(&mnth. - 1); %put l_mnth = &l_mnth.;10 %put l_mnth = &l_mnth.; l_mnth = 2
8
Converting Into Date Format Date %let d_date = %sysfunc(mdy(&mnth.,1,&yr.),date9.); %put d_date = &d_date.; –Log 11 %let d_date = %sysfunc(mdy(&mnth.,1,&yr.),date9.); 12 %put d_date = &d_date.; d_date = 01MAR2006 DateTime %let dt_date = %sysfunc(mdy(&mnth.,1,&yr.),date9.):00:00:00; %put dt_date = &dt_date.; –Log 13 %let dt_date = %sysfunc(mdy(&mnth.,1,&yr.),date9.):00:00:00; 14 %put dt_date = &dt_date.; dt_date = 01MAR2006:00:00:00
9
Running a job at a given time Job can't run until 3rd of the month at 2:30pm %let launch1 = %sysfunc(mdy(%sysfunc(month(%eval(&tdy.+30))),3, %sysfunc(year(%eval(&tdy.+30)))),date9.):14:30:00; %put launch1 = &launch1; data _null_; slept = wakeup("&launch1."dt); run; –Log 15 %let launch1 = %sysfunc(mdy(%sysfunc(month(%eval(&tdy.+30))),3, 16 %sysfunc(year(%eval(&tdy.+30)))),date9.):14:30:00; 17 %put launch1 = &launch1; launch1 = 03APR2006:14:30:00 Job can't run until Sunday at 8:00am %let launch2 = %sysfunc(mdy( sysfunc(month(%eval(&tdy. + %eval(((%sysfunc(weekday(&tdy.))) - 8) * -1)))), sysfunc(day(%eval(&tdy. + %eval(((%sysfunc(weekday(&tdy.))) - 8) * -1)))), sysfunc(year(%eval(&tdy. + %eval(((%sysfunc(weekday(&tdy.))) - 8) * -1))))), date9.):08:00:00;; %put launch2 = &launch2; data _null_; slept = wakeup("&launch2."dt); run; –Log 18 %let launch2 = %sysfunc(mdy( 23 %sysfunc(month(%eval(&tdy. + %eval(((%sysfunc(weekday(&tdy.))) - 8) * -1)))), 24 %sysfunc(day(%eval(&tdy. + %eval(((%sysfunc(weekday(&tdy.))) - 8) * -1)))), 25 %sysfunc(year(%eval(&tdy. + %eval(((%sysfunc(weekday(&tdy.))) - 8) * -1))))), 26 date9.):08:00:00; 27 %put launch2 = &launch2; launch2 = 12MAR2006:08:00:00
10
Customizing Output File Names %let mon_yr_nm = %sysfunc(mdy(&mnth.,1,&yr.),monyy5.); %put mon_yr_nm = &mon_yr_nm.; –Log 28 %let mon_yr_nm = %sysfunc(mdy(&mnth.,1,&yr.),monyy5.); 29 %put mon_yr_nm = &mon_yr_nm.; mon_yr_nm = MAR06 DDE Column Or Row Selection %let col = %eval((((&yr. - 2000) * 12) + &mnth.) - 74); %put col = &col.; –Log 30 %let col = %eval((((&yr. - 2000) * 12) + &mnth.) - 74); 31 %put col = &col.; col = 1 DDE Column Or Row Headings %let col_name = %sysfunc(mdy(&mnth.,1,&yr.),monname9.); %put col_name = &col_name.; –Log 32 %let col_name = %sysfunc(mdy(&mnth.,1,&yr.),monname9.); 33 %put col_name = &col_name.; col_name = March
11
Useful Date Functions
12
Useful Date Formats
13
Useful DateTime Formats
14
Lisa Horwitz Systems Engineer Manager for SAS
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.