Hi ,
I am trying to create monday and friday using sysfunc in sas EG but its not working for me.Kindly help me on below code.
%LET Monday = %SYSFUNC(INTNX('WEEK.2',%SYSFUNC(TODAY()),2),DOWNAME.);
%PUT &Monday;
%LET Friday = %SYSFUNC(INTNX('WEEK.6',%SYSFUNC(TODAY()),6),DOWNAME.);
%PUT &Friday;
Thanks,
Siva
Small changes
%LET Monday = %SYSFUNC(INTNX(WEEK.2,%SYSFUNC(TODAY()),0), 'b');
%PUT &Monday;
%LET Friday = %SYSFUNC(INTNX(WEEK.6,%SYSFUNC(TODAY()),0), 'b');
%PUT &Friday;
Small changes
%LET Monday = %SYSFUNC(INTNX(WEEK.2,%SYSFUNC(TODAY()),0), 'b');
%PUT &Monday;
%LET Friday = %SYSFUNC(INTNX(WEEK.6,%SYSFUNC(TODAY()),0), 'b');
%PUT &Friday;
What is the Purpose of this? Are you going to use the actual date variables or do you simply want to print 'Monday' and 'Friday' in the log?
I want to send automated email using email body mentioning monday date and friday date as "08Mon19 - 16Fri19"
So the real task is to get the string "08Mon19 - 16Mon19" into a macro variable?
Yes sir.This code will run on every friday it should display Current Week Monday to Friday date Dynamically.
here is the sample code
%LET TODAY=%SYSFUNC(TODAY(),DATE9.);
%PUT &TODAY;
%LET Monday = %SYSFUNC(INTNX(WEEK.2,%SYSFUNC(TODAY()),0), 'b');
%PUT &Monday DOWNAME.;
%LET Friday = %SYSFUNC(INTNX(WEEK.6,%SYSFUNC(TODAY()),0), 'b');
%PUT &Friday;
filename outbox email
to= ('XXX.YYY@abchealth.com')
cc= ('sivakumar.siva@abchealth.com')
type='text/html'
subject="Weekly Status";
data _null_;
file outbox;
put "Hi all";
put "<P>";
Put "Please find the Weekly Status Report of 08July2019 - 12jul2019 ";
put "<P>";
put "Thank you,";
run;
No need for messing with macro variables if you are already running a data step.
data _null_;
file outbox;
monday=intnx('week.2',today(),0);
friday=monday+4;
put 'Hi all';
put '<P>';
put 'Please find the Weekly Status Report of ' monday date9. ' - ' friday date9.;
put '<P>';
put 'Thank you,';
run;
@sivastat08 wrote:
I want to send automated email using email body mentioning monday date and friday date as "08Mon19 - 16Fri19"
Then why are you making it harder by trying to do it in macro code? Just do it in a data step and eliminate a lot of complexity.
Sure Tom.Thank you for such a detailed answer!
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.