Desktop productivity for business analysts and programmers

Emailing results of frequency procedure and text

Reply
Regular Contributor
Posts: 233

Emailing results of frequency procedure and text

What I want in the Email?

Data exists for 19AUG2014 on welcome weekly letter data set.


WEEKLY WELCOME DATA

The FREQ Procedure


13AUG2014


281


  1. 15.48

281


  1. 15.48

14AUG2014


307


  1. 16.91

588


  1. 32.40

15AUG2014


484


  1. 26.67

1072


  1. 59.06

18AUG2014


309


  1. 17.02

1381


  1. 76.09

19AUG2014


434


  1. 23.91

1815


  1. 100.00


I am getting the proc freq results but not the text "Data exists for 19AUG2014 on welcome weekly letter data set.". I am missing something and want help on this. Below is my code.

%LET CURDT1=%EVAL(%SYSFUNC(TODAY())-1);

%LET WEEK1=%SYSFUNC(PUTN(%EVAL(&CURDT1.),DATE9.));

MAILBOX EMAIL TO=("XXXX.XXXXX@XXXXX.COM") TYPE='text/html' SUBJECT='Data on Welcome Weekly Letter Data Set';

HTML BODY=MAILBOX RS=NONE;

DATA _NULL_;

SET TEST;

IF MAX_OPEN_DATE EQ TODAY()-1 THEN

PUT "DATA EXISTS FOR &WEEK1. ON WELCOME WEEKLY LETTER DATA SET.";

ELSE PUT "DATA MISSING FOR &WEEK1. ON WELCOME WEEKLY LETTER DATA SET.";

FREQ DATA=JK.WELCOME_LETTER_WEEKLY;

TABLES OPEN_DATE;

RUN;

ODS HTML CLOSE;

Frequent Contributor
Posts: 85

Re: Emailing results of frequency procedure and text

try to run it in a macro, so you can build TITLE statement

%MACRO DO_IT;
  %LET A=05;
  %LET B=02;
  filename MAILBOX EMAIL  TO=("herman.jacobs@axa.be") TYPE='text/html' SUBJECT='test test' ;

  %if &a GE &b %then %let text=' A >= B';
  %else              %let text=' A <= B';

  title;
  title ">>>> &text";

  ODS HTML BODY=MAILBOX RS=NONE ;
    proc FREQ DATA=sashelp.class ;
    TABLES sex;
  RUN;
  ODS HTML CLOSE;
%MEND;


%DO_IT;

HERMAN

Ask a Question
Discussion stats
  • 1 reply
  • 201 views
  • 3 likes
  • 2 in conversation