BookmarkSubscribeRSS Feed
Hima
Obsidian | Level 7

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;

1 REPLY 1
Jaheuk
Obsidian | Level 7

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

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 1 reply
  • 1082 views
  • 3 likes
  • 2 in conversation