Hi kurtBremser, Thank you for your inputs. Solution provided by you is working now. While creating date i have assigned date7. format for date which is working fine with your suggestion. Also i have made some changes in my current code(Changed the where condition) which gives me expected outputs. Please refer updated code. ----------precode----------
%let start_time=%sysfunc(datetime());
----------postcode--------------
%let end_time = %qsysfunc(datetime());
%let to_date=&sysdate.;
%put &to_date.;
proc sql;
select max(datepart(start_time)) format =date7.
into :date1 from target.job_control where job_name="&etls_jobname.";
run;
%put &date1.;
proc sql;
select max(datepart(start_time)) format =date7.
into :up_time1 from target.job_control where job_name="&etls_jobname.";
run;
%put &up_time1.;
/*%put dt=%sysfunc(datepart(%sysfunc(datetime())));*/
/*%let today_dt1=%sysfunc(datepart(%sysfunc(datetime())));*/
%let today_dt1=&sysdate;
%put &today_dt1.;
data aa;
todate=put(today(),best.);
call symput ('today_dt',todate);
run;
%put &today_dt.;
%macro execute;
%if "&up_time1"d = "&today_dt1"d
%then %do;
proc sql;
update target.job_control
set start_time=&start_time.,
end_time=&end_time.,
status ='Y'
/*where "&date1"d="&to_date"d and job_name='ch_1' and status='N';*/
where datepart(start_time)=%sysfunc(today()) and job_name="&etls_jobname.";
run;
%end;
%else %do;
proc sql;
insert into target.job_control values('Dashboard1',"&etls_jobname.",&start_time.,&end_time.,'sasdemo','Y');
run;
%end;
%mend;
%execute; Once again thank you for your valuable time.
... View more