DATA Step, Macro, Functions and more

How to check if a dataset is updated for a particular date

Accepted Solution Solved
Reply
Contributor
Posts: 66
Accepted Solution

How to check if a dataset is updated for a particular date

[ Edited ]

Hi,

 

I am trying to check if the table is updated for a particular date.

Once the data is available for the mentioned date an email need to triggered to a list of users, else need to check after a couple of hours.

 

Please help!!!!

 


Accepted Solutions
Solution
‎05-25-2016 05:25 PM
Super User
Posts: 9,662

Re: How to check if a dataset is updated for a particular date

Or you don't need create Integrity Constraint, just an Audit Dataset.

 


data class;
 set sashelp.class;
run;

proc datasets library=work nolist nodetails;
audit class;
initiate;
quit;


proc sql;
 update class
 set age=200
 where sex='F';
quit;

proc print data=class(type='audit');run;

View solution in original post


All Replies
Super User
Posts: 17,750

Re: ned to check if the dataset is updated for a particular date

How would you know if it's updated? Is there a field to check? Do you need to check the created date?

Contributor
Posts: 66

Re: ned to check if the dataset is updated for a particular date

Hi Reeza,

 

we have  field called CNTRL_DTE i have tried using this

%let Tdy= 01012016; /*Some dummy date used here*/

If cntrl_Dte= "&tdy." and obs = 0 then do;

put Note:"Check the table for updates after sometime";

End;

 

Else Do;

 

File email EM;

 

End;

Run;

 

for some reason this is not working sometimes this sends the email for the updates and some times hte log says

this condition

If cntrl_Dte= &tdy. and obs = 0 is false; 

 

Super User
Posts: 5,255

Re: How to check if a dataset is updated for a particular date

How is the table updated in the first place? Perhaps it's easier to automate the mail sending in that step/process?
Data never sleeps
Contributor
Posts: 66

Re: How to check if a dataset is updated for a particular date

Hi

The data is extracted from a teradata table, there a jobs scheduled.

the RDBMS jobs keep executing, periodically and the tables are updated as and when the data is avaialble.

the dataset which we are using to generate the report is most of the times updated by 14.00, and if the reports dosent contains the data for the date we are looking for, we check it in a couple of hours manually the data will be availabe by that time. and we re-generate the report once the data is loaded.

kindly suggest.

 

 

 

Super User
Posts: 9,662

Re: How to check if a dataset is updated for a particular date

Try create an Integrity Constraint and a AUDIT type dataset.

 



data class;
 set sashelp.class;
run;

proc datasets library=work nolist nodetails;
modify class;
ic create age=check(where=(age between 10 and 80))
 message='age must be between 10 and 80';
audit class;
initiate;
quit;


proc sql;
 update class
 set age=20
 where sex='F';
quit;

proc print data=class(type='audit');run;

The following will give you two obs for each and every obs which is updated. One is original obs, Another is the updated obs.

 

x.png

Solution
‎05-25-2016 05:25 PM
Super User
Posts: 9,662

Re: How to check if a dataset is updated for a particular date

Or you don't need create Integrity Constraint, just an Audit Dataset.

 


data class;
 set sashelp.class;
run;

proc datasets library=work nolist nodetails;
audit class;
initiate;
quit;


proc sql;
 update class
 set age=200
 where sex='F';
quit;

proc print data=class(type='audit');run;
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 338 views
  • 0 likes
  • 4 in conversation