BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
LorenaPalacios
Calcite | Level 5

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

 
Any suggestions? thank you!
 
Code

%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;

1 ACCEPTED SOLUTION

Accepted Solutions
Vince_SAS
Rhodochrosite | Level 12

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

View solution in original post

2 REPLIES 2
Vince_SAS
Rhodochrosite | Level 12

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

BeverlyBrown
Community Manager

@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.

Learn from the Experts! Check out the huge catalog of free sessions in the Ask the Expert webinar series.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 2 replies
  • 1146 views
  • 4 likes
  • 3 in conversation