Help using Base SAS procedures

program to be check that dataset have been updated yesterdayor not?

Reply
N/A
Posts: 0

program to be check that dataset have been updated yesterdayor not?

Hi,
programs to check datasets that they have been updatedto day .Then check the contents of the datasets for data from yesterday.

if condition false then the program should check again in 30 min. if true then run all programs.

This process basically to shedules the job in batch

thanks,
chandra
Super Contributor
Posts: 260

Re: program to be check that dataset have been updated yesterdayor not?

Hi Chandra.
For information on dataset creation / last modification date, check the Contents procedure, or the SASHELP.VTABLE view.
For comparing datasets, use the Compare procedure.
To make SAS wait, you can use the SLEEP function within a Data step.
For conditionnal executing of SAS programs, see what you can do with macro language.
Regards;
Olivier
N/A
Posts: 0

Re: program to be check that dataset have been updated yesterdayor not?

Hi Oliver,

THANKS FOR REPLAY . COULD YOU PLEASE SEND ME IF U HAVE ANY SAMPLE CODE FOR THAT


THANKS,
CHANDRA.
Super Contributor
Super Contributor
Posts: 3,174

Re: program to be check that dataset have been updated yesterdayor not?

The SAS support website http://support.sas.com is chock full of code samples and SAS documentation, which can be amazingly helpful with learning the SAS language to hone one's skills.

Another option is to use GOOGLE.COM or another search engine to search the SAS.COM site for code snippets and SAS User Group SUGI/SGF technical papers on these and other SAS programming topics.

Lastly, the SAS-L list archives are also a wealth of information for your benefit and ever-increasing knowledge opportunity.

Scott Barry
SBBWorks, Inc.

http://support.sas.com/
Super User
Posts: 5,257

Re: program to be check that dataset have been updated yesterday or not?

Hi,
here is some sample (untested!) code you can start with. Have a look in doc for PROC COMPARE and SYSINFO for details.
About the rechecking, I suggest that you use a scheduling tool for that, such as cron in UNIX.

Regards,
Linus


%macro checkdata;

data _null_;
dsid = open('libname.table');
updated_dt = attrn(dsid, 'MODTE');
if "&SYSDATE9"D eq datepart(updated_dt) the call symput('UPDATED','Y');
else call symput('UPDATED','N');
run;

%if &UPDATED eq Y %then %do;

proc compare data=lib.today compare=lib.yesterday;
...;
run;

%if &SYSINFO ne 0 %then %do;
%include "program.sas";
%end;

%end;

%mend checkdata;

%checkdata;
Data never sleeps
Ask a Question
Discussion stats
  • 4 replies
  • 115 views
  • 0 likes
  • 4 in conversation