Download quikmail.sas quikmail.sasSubmit a comment

%macro quikmail (to,subj,body);

  %*----------------------------------------------------------------;
  %* Author: Richard DeVenezia
  %*
  %* mod:
  %* 11/18/98 rad initial coding
  %*----------------------------------------------------------------;

  %if (%superq(to) eq ) %then
    %let to=foobar;

  %if (%superq(to) ne and %superq(subj) ne and %superq(body) ne) %then %do;

    filename quikmail email "%superq(to)" subject="%superq(subj)";
    data _null_;
      file quikmail;
      put "%superq(subj)";
      %let body=%left(%superq(body));
      %do %until (%superq(body) eq);
        %let p=%index(%superq(body),\n);
        %if (&p eq 0) %then %do;
          put "%superq(body)";
          %let body=;
        %end;
        %else %do;
          put "%substr(%superq(body),1,%eval(&p-1))";
          %if (%eval(&p+2) gt %length(%superq(body))) %then
            %let body = ;
          %else
            %let body = %substr (%superq(body),%eval(&p+2));
        %end;
      %end;
    run;

  %end;

%mend quikmail;