02-16-2014 12:47 AM
My requirement is to check the data set exist in one location. expected date every month 15th need to check up to 18th if data set not placed in that location I need to send mail to client data set not available. pls help me how to achieve this task through loop, arrays or macros.
02-16-2014 02:40 AM
The exist() function can be used in data steps (not necessarily data _NULL_ and macros as shown below:
/* in data step */
if exist("<your dataset>") then do; /* use quotes */
/* in macro */
%if %sysfunc(exist(<your dataset>)) %then %do; /* no quotes */
However, your data set nomenclature and other related criteria is required to further design the looping. Anyway, hope this helps.
02-16-2014 02:59 AM
Thanks for help. but how I set the condition to send mail if data set not exist or not present in specified location after 3 days(15-18
th date). I need to check for 3 days if exist then process else send mail.
02-16-2014 03:09 AM
I would assume what you need to do is to run this code for the relevant time period. You then also would need to maintain a control table to log cases where you've actually found the data set (eg. you find it on the 16th, process it, write an entry to the control table. You run it on the 17th: check the control table and if already run successfully stop any further processing).
So if running on the 18th and there is no new file and you haven't processed it on an earlier date (control table): execute SAS code sending an email. If you "Google" a bit you will find sample code of how to do this.