05-09-2014 01:55 PM
I have dataset with date and working day flag(1 is working and 0 means non-working day). Then
I have sales dataset with sales number and sales_date. I have another dataset with Inventory number and Inv_date.
What I have to do is, check if everyday if current day is working day or not. If it is working day then check if there are sales for today from Sales dataset and Inventory for today from Inventory dataset, If either Sales or Inventory or both conditions are not satisfied then send email through SAS saying that "Sales data is missing for today or Inventory data is missing or Both data are missing".
Any help in this will be greatly appreciated..
05-09-2014 02:21 PM
What do you want sent in your email? A file of errant info attached to the email; a list of errant info in a txt file attached to the email; a line of text in the email itself for each errant row? The data can be analyzed wth a data step or sql step or something else. Which do you prefer? Are you emailing from your PC or a remote session such as a mainframe or unix or etc.?
05-09-2014 02:38 PM
I want to send the email saying that "Sales data and Inventory data missing" /*** if both data are missing *********/
"Sales data is missing" /*****if only sales data is missing *******/
"Inventory data is missing" /*****if only Inventory data is missing *******/
I will be mailing from PC. SAS running on Windows 7 environment.
05-09-2014 07:06 PM
I'm assuming you're running this on a daily basis? Would it be checking for the same day or for the previous day?
Id also recommend checking the number of records vs the expected status.
05-10-2014 07:57 AM
I will be running it on daily basis and checking for the same day. Yes I would check for records for that day so that I can send email based on which dataset has 0 records.
05-09-2014 03:16 PM
SQL code can build, compare the three datasets and decide which &failed. condition exists. When the SQL is complete, execute the macro. There are also ways other than SQL to decide which of the three failed conditions exist.
filename mymail email;
subject=(" Put your subject here ")
%if &failed. = 1 %then %do;
put " Sales data is missing ";
%if &failed. = 2 %then %do;
put "Inventory data is missing" ;
%if &failed. = 3 %then %do;
put "Sales data and Inventory data missing" ;