Getting day of week from macro variable

I have a macro variable formatted as a date and am trying to use the weekday function to obtain the day of the week that corresponds to the value of my macro variable.

I’m receiving an error stating, "Argument 1 to function weekday referenced by the %sysfunc macro function is not a number".

Posted my code below. What am I doing wrong? TIA.

/*Assign program run date*/
%Let RefDate = %unquote(%str(%')%sysfunc(intnx(day,%sysfunc(today()),-0),mmddyy8.)%str(%'));

%let run_day2 = %sysfunc(inputn(%sysfunc(compress(&refdate., "'")), mmddyy8.), date9.);
%put &run_day2.;

*Assign today;
%let current_day = %sysfunc(weekday(&run_day2));
%put Current day of week: &current_day;

>Solution :

Here’s a simpler version:

%let current_day = %sysfunc(today(), weekday.);

Leave a Reply