lyndseypaja
MIS
I'm trying to run a report each week that includes data for Monday to Sunday (for the previous week).
I've plagorised some code to get the dates for last week, but, I'm stuggling to get this to work when using the macros in my code.
This is what I've used for obtaining dates...
data _null_;
i = put(today(),weekday.);
prevsundate = put(today()-i+1,yymmdd10.);
prevmondate = put(today()-(i+5),yymmdd10.);
call symput("Mon","'"!!prevmondate!!"'");
call symput("Sun","'"!!prevsundate!!"'");
run;
%put &Mon. and &Sun.;
I need to report between &Mon and &Sun when I try
where open_date >= &mon. and open_date <= &sun.
I get this error in the log:
Expression using greater than or equal (>=) has components that are of different data types.
Please let me know if you can help
I've plagorised some code to get the dates for last week, but, I'm stuggling to get this to work when using the macros in my code.
This is what I've used for obtaining dates...
data _null_;
i = put(today(),weekday.);
prevsundate = put(today()-i+1,yymmdd10.);
prevmondate = put(today()-(i+5),yymmdd10.);
call symput("Mon","'"!!prevmondate!!"'");
call symput("Sun","'"!!prevsundate!!"'");
run;
%put &Mon. and &Sun.;
I need to report between &Mon and &Sun when I try
where open_date >= &mon. and open_date <= &sun.
I get this error in the log:
Expression using greater than or equal (>=) has components that are of different data types.
Please let me know if you can help