Hi,
sending email I reveive file in use error on lib.loaded, could anyone plese tell me what`s that mean, and how to handle it?
Filename mymail email
From="example@mail.com"
Sender="example@mail.com"
to=( "example@mail.com")
type='text/html'
%if &left_count >0 %then %do;
Subject="Warning: &Process_name has been finished %sysfunc(putn(%sysfunc(today()),DDMMYYS10.))" encoding=LATIN2;
%end;
%if &left_count=0 %then %do;
Subject="OK:&Process_name has been finished %sysfunc(putn(%sysfunc(today()),DDMMYYS10.))%sysfunc(putn(%sysfunc(today()),DDMMYYS10.))" encoding=LATIN2;
%end;
Data _null_;
file mymail;
ods html body=mymail;
ods text= "Some message" ;
proc print data=lib.loaded(where=(data_danych=%sysfunc(today())) rename=(importowane="Wczytane pliki"n));
var "Wczytane pliki"n;
run;
%if &left_count >0 %then %do;
ods text= "Some message ";
proc print data=lib.listed_left;
run;
%end;
ods text= "Some message";
ods html close ;
Run;
Thank you.
Please supply the whole log of the macro, so we can see the message(s) and the missing macro code.
There is a whole raft of issues in that code.
First off you have procedure calls within a datastep which is invalid (proc print within data _null_;
Next up you have macro code in open code - i.e. the macro code is not within a macro.
As such it needs a re-write. To start with:
%macro em (); filename...; %mend em; %em;
One your code is within a macro then the macro code can evaluate. So the %if's will work.
Next up this part:
ods html body=mymail;
Unitl the close, needs to be its own block, and added. Check this example:
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.