0

I am trying to send an email using SAS from within Linux, In the body of the email I have a reference to a macro.

* store &a in macro for use in email; 
proc sql noprint;
    select tot_sendt into :a from tot;
run;


* sending email;
filename m email subject="Report A is ready (%SYSFUNC(today(),ddmmyy10.))"
to = ('myemail@email.com');

data _null_;
  file m;
  put 'Report A ready;
  put 'Totalt sent is:' &a; *a is a number stored in a macro;
run;

However, this code throws the following error: test_pgm.log.140825.1227:ERROR: DATA STEP Component Object failure. Aborted during the COMPILATION phase. test_pgm.log.140825.1227:ERROR 557-185: Variable set is not an object.

I have also tried

  put 'Totalt sent is &a'; a is a number stored in a macro

Which just writes &a in to email body.

Joe
  • 62,789
  • 6
  • 49
  • 67
Alexander
  • 624
  • 2
  • 7
  • 18
  • 1
    FYI to other users - I'm going to use the question I marked this duplicate to as the 'reference question' for any identical issues. Don't add a new answer to them, just mark as duplicate. You can find it easily on a search for `[sas-macro] single quotes`. – Joe Aug 25 '14 at 14:49

1 Answers1

1

Macro variables won't resolve inside of single quotes.

put "Totalt sent is &a" ;

should work.

Also note you are missing the closing single quote on your first PUT statement.

Quentin
  • 5,960
  • 1
  • 13
  • 21