BookmarkSubscribeRSS Feed
mmea
Quartz | Level 8

Hi 

Evry day I send some files into a folder

these files are created in this macro - when the files are sent I get an email that says files has been send - if it fails I get an email that says error.

I want to create a text file with some text that has to be sent to the folder with the files IF the files has no errors. How can I add that in the do and else function?

 

%macro leverance(region);
/*tabel 1*/
here I will have code for the datasets
/*tabel 2*/
here I will have code for the datasets
/*tabel 3*/
here I will have code for the datasets
/*tabel 4*/
here I will have code for the datasets
/*tabel 5*/
here I will have code for the datasets
/*tabel 1*/

here I will have code for the datasets

%do i=1 %to 5;

proc export data=tabel&i. replace
  outfile="&out_folder.\&data._TAB&i._&YYYYMMDD..csv"
  dbms=dlm
;
delimiter=';';
quit;

%end;
%mend;


%macro dummy_macro();
%if &nobs ne 4 %then %do; 

filename mymail email from='test@test.org' to=&mailto.
         subject='ERROR - the data has not been send'

%end;
%else %do;

%leverance(A);
%leverance(B);
%leverance(C);
%leverance(D);
%leverance(E);

filename mymail email from='test@test.test' to=&mailto.
         subject='The files has been succesfully send';

%end;
%mend;

%dummy_macro();
2 REPLIES 2
ballardw
Super User

How and where do you determine "the files has no errors"?

 

What is an example of the text that gets sent? If the message does not change then likely the easiest would be to have a SAS data set with a single variable containing the text and then Export that the same as you are currently doing.

mmea
Quartz | Level 8

i make a script where it can see if there is mistakes in the log-file

The email is always the same - so if there is an error in the script I get the same mail.

If all files a developed without erros I also get the same mail that everything is good.

 

How can I do the datastep as you say?

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 363 views
  • 0 likes
  • 2 in conversation