I want to make the following make the following dynamic/automated with intnx(), so I don't need to change the macrovariable manually each month I use my code. After I define it, I use it in the where condition of a SQL procedure. %let datetime = '01aug2024 00:00:00'dt; The following code generates the first day of the last month, however I need it exactly as stated in the static example above. %let mydt = %sysfunc(intnx(day, %sysfunc(intnx(month, %sysfunc(date()), -1)), 0), Date9.);
%put &mydt; When I try the following code, which should be a valid solution according to my knowledge, I get 01JAN1960:06:00:00 %let mydt = %sysfunc(intnx(day, %sysfunc(intnx(month, %sysfunc(date()), -1)), 0));
%let mydt = %sysfunc(intnx(hour, &mydt., 0));
%let mydt = %sysfunc(intnx(minute, &mydt., 0));
%let mydt = %sysfunc(intnx(second, &mydt., 0), Datetime.);
%put &mydt; How can I solve this problem? I tried concatenation and countless other approaches that didn't work and it starts to drive me to despair. Thank you for your advice and help in advance!
... View more