Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

/*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.);
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading