Hello
I am not able to control the outputs in HMTL3 to send reports and graphics by mail.
I show you the code, it works correctly but when I attach a graphic it automatically aligns all the text and numbers of the reports to the left
%let workdir=%trim(%sysfunc(pathname(work)));
ods graphics on / width=10 in height=3.5in;
ods _ALL_ close;
ods listing gpath="&workdir";
ods graphics / reset=index outputfmt=PNG imagename='graf1';
title1;
footnote1;
proc sgplot data=PARA_GRAFICO_DIARIO1 noborder ;
filename sendmail email to=("maria.palacios@ypf.com") from=("maria.palacios@ypf.com")
attach = ("&workdir.\graf1.png" inlined='graf1' )
type='text/html' subject="Emailing graphics output";
options emailsys=smtp;
options emailhost="xxx";
ods _all_ close;
ods html file=sendmail STYLE=sasweb;
proc report data=WORK.RESUMEN_PRODUCCION nowindows headline headskip missing center style(report)=[cellspacing=2 borderwidth=2 ]
footnote1 '<img src=cid:graf1>';
proc report data=WORK.SC_ALERTA_SEMANAL nowindows headline headskip missing center style(report)=[cellspacing=2 borderwidth=2 ]
style(header) = {font_weight = light font_face = 'Calibri' font_size = 9pt just = center cellheight=.65in backgroundcolor=lightgray}
ods html close;
ods listing;
filename sendmail clear;
What version of SAS are you running, and what operating system is SAS running on?
I could not reproduce the problem using this code:
options emailsys=smtp
emailhost='xxx';
%let WORKDIR=%sysfunc(pathname(work));
ods _all_ close;
ods graphics on / width=10 in height=3.5in;
ods graphics / reset=index outputfmt=png imagename='graf1';
filename sendmail email to='to-address-here' from='from-address-here'
attach = ("&WORKDIR\graf1.png" inlined='graf1')
type='text/html' subject='Emailing graphics output';
ods listing gpath="&WORKDIR";
title;
footnote;
proc sgplot data=sashelp.class noborder; hbar age; run; quit;
ods listing close;
ods html3 file=sendmail style=sasweb;
proc report data=sashelp.class headline headskip missing center
style(report)=[cellspacing=2
borderwidth=2];
where (sex eq 'F');
run; quit;
footnote '<img src=cid:graf1>';
proc report data=sashelp.class headline headskip missing center
style(report)=[cellspacing=2 borderwidth=2]
style(header) = [font_weight = light
font_face = 'Calibri'
font_size = 9pt
just = center
cellheight=.65in
backgroundcolor=lightgray];
where (sex eq 'M');
run; quit;
ods html3 close;
ods listing;
filename sendmail clear;
The data in character columns Name and Sex are left-aligned, and the data in the numeric columns Age, Height, and Weight are right-aligned.
Vince DelGobbo
SAS R&D
What version of SAS are you running, and what operating system is SAS running on?
I could not reproduce the problem using this code:
options emailsys=smtp
emailhost='xxx';
%let WORKDIR=%sysfunc(pathname(work));
ods _all_ close;
ods graphics on / width=10 in height=3.5in;
ods graphics / reset=index outputfmt=png imagename='graf1';
filename sendmail email to='to-address-here' from='from-address-here'
attach = ("&WORKDIR\graf1.png" inlined='graf1')
type='text/html' subject='Emailing graphics output';
ods listing gpath="&WORKDIR";
title;
footnote;
proc sgplot data=sashelp.class noborder; hbar age; run; quit;
ods listing close;
ods html3 file=sendmail style=sasweb;
proc report data=sashelp.class headline headskip missing center
style(report)=[cellspacing=2
borderwidth=2];
where (sex eq 'F');
run; quit;
footnote '<img src=cid:graf1>';
proc report data=sashelp.class headline headskip missing center
style(report)=[cellspacing=2 borderwidth=2]
style(header) = [font_weight = light
font_face = 'Calibri'
font_size = 9pt
just = center
cellheight=.65in
backgroundcolor=lightgray];
where (sex eq 'M');
run; quit;
ods html3 close;
ods listing;
filename sendmail clear;
The data in character columns Name and Sex are left-aligned, and the data in the numeric columns Age, Height, and Weight are right-aligned.
Vince DelGobbo
SAS R&D
@LorenaPalacios, I checked with a tech support colleague. He said answering this question will involve some diagnostic effort best facilitated by SAS Technical Support. You can open a track through any of the ways listed here: https://support.sas.com/techsup/contact/
Thank you for being a part of the SAS communities.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.