Issue with the below code.
The Report date is not getting matched in the below code. So, no rows are getting updated.
%let REPORT_DATE=%sysfunc(putn(%sysevalf(%sysfunc(today()) - 1), yymmddd10.)); */to get yesterday date in YYYY-MM-DD format/*
proc sql;
connect to teradata (user="***********" password="*************" server="****************"
mode=teradata);
create table FLOW_YESTERDAY as
select * from connection to teradata
( SELECT * FROM EDWDB.FLOW_ITD
WHERE CAST(T1_DATE AS DATE) = &REPORT_DATE ); */T1_DATE='2021-03-23' gives the required output/*
disconnect from teradata;
quit;
proc append base=SASVA.FLOW data=FLOW_YESTERDAY;
run;
Please provide a way around.
Looks like you need to wrap the macro variable in single quotes but still resolve the value. Here is one way:
%let REPORT_DATE=%sysfunc(putn(%sysevalf(%sysfunc(today()) - 1), yymmddd10.)); */to get yesterday date in YYYY-MM-DD format/*
proc sql;
connect to teradata (user="***********" password="*************" server="****************"
mode=teradata);
create table FLOW_YESTERDAY as
select * from connection to teradata
( SELECT * FROM EDWDB.FLOW_ITD
WHERE CAST(T1_DATE AS DATE) = %str(%')&REPORT_DATE%str(%') ); */T1_DATE='2021-03-23' gives the required output/*
disconnect from teradata;
quit;
Instead of
%let REPORT_DATE=%sysfunc(putn(%sysevalf(%sysfunc(today()) - 1), yymmddd10.));
do
data _null_;
call symputx("report_date","'"!!put(today()-1,yymmddd10.)!!"'","g");
run;
to add single quotes.
You are comparing your date variable to the formula 2021 minus 3 minus 23 .
Add quotes.
Here is a simple macro to make it easier.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.