BookmarkSubscribeRSS Feed
Ujjawal
Quartz | Level 8

Hi Experts,

How can i tell SAS to notify me via email once macro finished processing? Also, can i mention in the email processing time - time taken by macro with the attachment CSV file generated by macro?

%macro replace (input= prac.file1,stats=median,vars=Q1-Q5,output=replaced);

* Generate analysis results ;

proc means data=&input noprint;

var &vars;

output out=dummy (drop=_type_ _freq_) &stats= / autoname;

run;

* Convert to vertical ;

proc transpose data=dummy out=dummy;

run;

* Replace missing with analysis results ;

data &output;

set &input;

array vars &vars ;

do i =1 to dim(vars);

set dummy(keep=col1) point= i ;

vars(i)=coalesce(vars(i),col1);

drop col1 ;

end;

run; 

Proc export outfile = &output data ='\user\ujjwal'

dbms =csv;

run;

%mend;

Options mprint nosymbolgen;

%replace (input= prac.file1,stats= median,vars=Q1-Q5,output=replaced);

2 REPLIES 2
BrunoMueller
SAS Super FREQ

hi

You can send emails from a SAS program using FILENAME statement with the EMAIL access method, see here for more information SAS(R) 9.4 Statements: Reference, Third Edition

sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10

Also, as to your question about capturing/reporting processing-time:  the SAS DATA step function DATETIME() can capture the current date/time into either a SAS DATA step variable or also using SYMPUT you can capture the character-string equivalent to a SAS macro variable.  With this coding technique applied, then any SAS code-piece can have a pre-processing (initialization) DATETIME() data capture and a post-processing (clean-up) execution to derive an elapsed time.

And with this information, your options are to either make use of MACRO variable "passing" between the initialization and clean-up code-points to derive an elapsed-time data value -- or otherwise more simplified approach having a SAS temporary dataset with the variable containing the start-time and then having the end-time to compute a duration-execution.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1332 views
  • 0 likes
  • 3 in conversation