Hi, Base SAS I would like to end session, below is my code. data today; Today = date()-1; put Today= date.; run; proc sql; create table temp_date as select 'date'as date,(TODAY)format yymmdd10. as date from today; quit; /* Max Date 1*/ proc sql exec; connectto sqlservr as Sstats (server= myserver1 database =mydatabase1); create table 1_maxdate as select Date,MAXDATE from connection to sstats( SELECT 'date'as date,MAX(date) AS MAXDATE FROM [dbo].[t_1ReportData]); disconnect from sStats; quit;run; /* Max Date 2 */ proc sqlexec; connectto sqlservr as Sstats (server= myserver2 database=mydatabase2); create table 2_maxdate as select Date,MAXDATE from connection to sstats( SELECT 'date'as date,MAX(rpt_date) AS MAXDATE FROM [dbo].[t_2ReportData]); disconnect from sStats; quit;run; proc sql; create table 1_Maxdate as select Date,DATEPART(MAXDATE)formatyymmdd10. as source1 from 1_Maxdate; quit; proc sql; create table 2_Maxdate as select Date,DATEPART(MAXDATE)formatyymmdd10. as source2 from 2_Maxdate; quit; DATA temp; SET TEMP_DATE 1_MAXDATE 2_MAXDATE; RUN; data Update_Status(drop = Date); update temp (obs=0) temp; by date; run; proc sql; create table Error_Checking as select case when date = source1 then '1'else '0' end as source1, case when date = source2 then '1'else '0' end as source2 from Update_Status; quit; ABORT BEFORE PROC MEANS IF ABOVE SOURCE1 OR SOURCE2 RETURN 0 /* Proc Means Results */ Proc Means noprint data = results.myData(where =(date >= &fromdate and date <= &todate)); CLASS date My1 My2 ; output out=My Output SUM=; RUN; I attempted to add what you suggested to Error_Checking but program continued on to process proc means. Thanks Fred
... View more