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

Hi!

I am trying to code an automatic email for a daily report I do. I can get most of it to work, however, I can't seem to get the percentages to print out in the correct format once it is sent out.

 

Please see code below (Please note I redacted sensitive information):

 


Data bullet1;
Set test;
CALL SYMPUT ('bullet1',prop_new);
CALL SYMPUT ('DIF_bullet1', DIF_bullet1);
KEEP today_s_date prop_new DIF_bullet1;
Run;

 

OPTIONS EMAILSYS=smtp Emailhost = amail.placeholder.org EMAILPORT=25 EMAILID="s@placeholder.org"; 
FILENAME Mailbox EMAIL ATTACH=("T:Filepath");
FILENAME Mailbox EMAIL ATTACH=("T:Filepath");


Data _NULL_;
FILE Mailbox TO=('C@placeholder.org')
CC=('S@Placeholder.org')

SUBJECT="Report &today";

PUT "The &today Report.";
PUT " ";
PUT "• As of &today, The proportion of beds is &bullet1.% (&DIF_bullet1.% change from the previous day).";
PUT "• Placeholder.";
PUT "• Placeholder.";
PUT "• Placeholder";
PUT "• Placeholder";
PUT "• Placeholder";
PUT "• Placeholder.";
PUT "• Placeholder";
PUT "• Placeholder.";

 

proc printto;
RUN;

 

How the email outputs:

 

The 15SEP2022 Report.

 

  •   As of 15SEP2022, The proportion of beds is 0.0342627711% (-0.000806103% change from the previous day).
1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

What is the correct format? You didn't tell us.

 

However, you can assign whatever format you want in your CALL SYMPUT (which should really be CALL SYMPUTX). For example:

 

CALL SYMPUTX('DIF_bullet1', put(DIF_bullet1,yourformatgoeshere.));

 

assuming variable DIF_bullet1 is numeric.

 

If you use the PERCENT. format, you don't even need to append a percent sign later in the PUT statement.

 

Lastly, may I be so bold as to comment on your choice of words? Here:

As of 15SEP2022, The proportion of beds is 0.0342627711%

 

Proportions should NOT have a percent sign afterwards. Percents (which is the proportion times 100) should have a % sign afterwards. And so the sentence should read (I think)

 

As of 15SEP2022, The percent of beds is 3.42627711%

 

 

--
Paige Miller

View solution in original post

1 REPLY 1
PaigeMiller
Diamond | Level 26

What is the correct format? You didn't tell us.

 

However, you can assign whatever format you want in your CALL SYMPUT (which should really be CALL SYMPUTX). For example:

 

CALL SYMPUTX('DIF_bullet1', put(DIF_bullet1,yourformatgoeshere.));

 

assuming variable DIF_bullet1 is numeric.

 

If you use the PERCENT. format, you don't even need to append a percent sign later in the PUT statement.

 

Lastly, may I be so bold as to comment on your choice of words? Here:

As of 15SEP2022, The proportion of beds is 0.0342627711%

 

Proportions should NOT have a percent sign afterwards. Percents (which is the proportion times 100) should have a % sign afterwards. And so the sentence should read (I think)

 

As of 15SEP2022, The percent of beds is 3.42627711%

 

 

--
Paige Miller

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 1 reply
  • 345 views
  • 0 likes
  • 2 in conversation