I developed a code to send email when a process ends.
But every first time that I run the program appears the following error:
ERROR: Insufficient authorization to access
/is/directory/outbox.dat.
After the first try it works fine.
Can you help me to understand what error is that?
SAS CODE:
DATA WORK.SEND_EMAIL;
ATTRIB NM_PROG LENGTH= $80;
ATTRIB CD_USUARIO LENGTH= $10;
ATTRIB NM_USUARIO LENGTH= $80;
NM_PROG = TRANWRD(&_CLIENTPROJECTNAME., ".egp", "");
CD_USUARIO = &_CLIENTUSERID.;
NM_USUARIO = &_CLIENTUSERNAME.;
RUN;
DATA _null_;
SET WORK.SEND_EMAIL;
CALL SYMPUT('NM_PROG', NM_PROG);
CALL SYMPUT('CD_USUARIO', CD_USUARIO);
CALL SYMPUT('NM_USUARIO', NM_USUARIO);
RUN;
PROC OPTIONS
GROUP=EMAIL;
RUN;
DATA _null_;
FILE OUTBOX;
PUT "Srs.,";
PUT "</br>Informo que o programa <b><i>&NM_PROG.</i></b> chegou ao fim do processo.";
PUT "</br></br><b>Executado por:</b> &NM_USUARIO.</br>";
RUN;
%PUT _ALL_;
FILENAME OUTBOX EMAIL
TO='email@email.com.br'
TYPE='TEXT/HTML'
SUBJECT="SAS - &NM_PROG. ";
move FILENAME OUTBOX statment before using it.
That is:
...
FILENAME OUTBOX EMAIL TO='email@email.com.br' TYPE='TEXT/HTML' SUBJECT="SAS - &NM_PROG. ";
DATA _null_; FILE OUTBOX; PUT "Srs.,"; PUT "</br>Informo que o programa <b><i>&NM_PROG.</i></b> chegou ao fim do processo."; PUT "</br></br><b>Executado por:</b> &NM_USUARIO.</br>"; RUN;
move FILENAME OUTBOX statment before using it.
That is:
...
FILENAME OUTBOX EMAIL TO='email@email.com.br' TYPE='TEXT/HTML' SUBJECT="SAS - &NM_PROG. ";
DATA _null_; FILE OUTBOX; PUT "Srs.,"; PUT "</br>Informo que o programa <b><i>&NM_PROG.</i></b> chegou ao fim do processo."; PUT "</br></br><b>Executado por:</b> &NM_USUARIO.</br>"; RUN;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.