SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Keegan
Obsidian | Level 7

When I run the following logic, the first table doesn't produce a title, but the second one does.

%macro email;

%if &total_obs>0 %then %do;

data _null_;
call symputx("today",put(today()-1,mmddyy10.));
run;

options EMAILSYS=SMTP EMAILID="xxxx.xxxxx@xxxxxxx.com" EMAILHOST="email.xxxx.com";


FILENAME output EMAIL SUBJECT="ERCOT flow count as of &today." 
                                                                       FROM="xxxx.xxxxx@xxxxxxx.com" 
                                                                       TO=("xxxx.xxxxx@xxxxxxx.com" )
																	 	type='text/html'
																		CT ='text/html';																

title;
footnote;
ods html3 (id=mail) body=OUTPUT

style=htmlblue;
ods escapechar='^';
ODS TEXT="^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black} ";
ODS TEXT="^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black}Good morning,";
ODS TEXT="^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black} ";
ODS TEXT="^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black}See counts below and let me know if you have questions.";
ODS TEXT="^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black}Attached worksheet for reference. ";
ODS TEXT="^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black}Thanks,";
ODS TEXT="^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black}Keegan";

title;
*** New Connects table ***;
proc print data=acq_final noobs
 style (table) = [frame=box borderwidth=1 ]
style (data) = {just=c}
style (header) = {just=c};
TITLE "New Connects";
run;
title;

*** All other counts table ***;
proc print data=all_final noobs
 style (table) = [frame=box borderwidth=1 ]
style (data) = {just=c}
style (header) = {just=c};
TITLE "Other Flow Counts";
run;
title;

ods html3 (id=mail) close;

%end;
%mend;
%email;

This is the email output:

Keegan_1-1638396460753.png

 

You'll notice that the title of the second table prints, but not the first. Why is this? What can I do to fix this? @ChrisHemedinger 

 

Thank you for your help!

Keegan

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
Testing shows it's the interaction between the ODS TEXT statements and TITLE that is causing the issue. If you switch the ODS TEXT statements to PROC ODSTEXT instead it seems to go away.

https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/odsproc/n06rruvsw8xaqnn17cofvmpz7j31.htm

No idea why or if this is expected behaviour though.

View solution in original post

4 REPLIES 4
Reeza
Super User
Testing shows it's the interaction between the ODS TEXT statements and TITLE that is causing the issue. If you switch the ODS TEXT statements to PROC ODSTEXT instead it seems to go away.

https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/odsproc/n06rruvsw8xaqnn17cofvmpz7j31.htm

No idea why or if this is expected behaviour though.
Keegan
Obsidian | Level 7

Thank you! This worked. To clarify, this was the updated syntax:

 

PROC ODSTEXT; p "^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black} ";
PROC ODSTEXT; p "^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black}Good morning,";
PROC ODSTEXT; p "^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black} ";
PROC ODSTEXT; p "^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black}See counts below and let me know if you have questions.";
PROC ODSTEXT; p "^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black}Attached worksheet for reference. ";
PROC ODSTEXT; p "^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black}Thanks,";
PROC ODSTEXT; p "^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black}Keegan";

Thank you for your help!

Reeza
Super User
I think you can use only one PROC ODSTEXT statement, you don't need multiple do you? That's one of the benefits of PROC ODSTEXT, it can do texts/paragraphs etc.
Keegan
Obsidian | Level 7

Right again!

Thank you so much!

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1201 views
  • 6 likes
  • 2 in conversation