hi, I am wondering how to send a bar chart in email, it could be in the body or text. the SAS job is scheduled to run a SAS server. I tried to save the chart as gif on the server first, then send it as an attachment, however, the .gif is not saved in the directory as specified in the program, it is saved at some random work folder. So when attaching to the email, the email failed because not being able to find the attachement. Any ideas?
is it possible for you to write another code in the same program where you can direct the output to a desired location. probably you can give a specific path, so that the generated chart be saved. After this code you can write the following code, which will send the chart as attachment to the email address mentioned
filename myemail email from=("xxxx@xxxxxx.com")
to=("xxxxx@xxxxx.com")
Subject = "An email from SAS"
Attach = "C:\Documents and Settings\chart.gif";
data _null_;
file myemail;
put "Please see attached.";
run;
During execution of the sas code, first the chart will be generated and will be saved in the desired location and then email code will execute which will send the attachment.
Thanks,
Jag
Jagadishkatam is definitely pointing you in the right direction!
To give a more complete answer, it would be useful to see your SAS code. The code to control where the output is written will vary, depending on a lot of things.
Also, how you're scheduling the job to run on a SAS server (via EG, a stored process, a Unix cron job, a Windows scheduled task, etc) ... and are you using the SAS job to send the email & attachment, or is that a Unix/DOS script, etc? I would suggest doing it all in the SAS job, as Jagadishkatam has shown. Here is a SAS job similar to his, that shows how to include multi-line text in the email:
http://robslink.com/SAS/democd38/iPhone_mailer.sas
And, if you've got SAS 9.4, there's even a new/enhanced way to send graphs! You can use html5 to create a single html file that contains both the graph and the html overlay (with html mouse-over text, drilldowns, etc). Assuming you've got SAS 9.4, and your email recipients are using a browser that supports html5. Here's a blog post with more details:
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.