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

Hi Gurus,

 

I am banging my head to get the required output

 

I have the dataset which gives me the max date of the column and I want to send the RESULT through email but not as an attachement but I am not getting any solution to it. Below is the output from the dataset which I want to send to email.

 

MAX_of_DATE_OF_EFFECT
13/06/2017 21:45

 

I tried to export the output to excel sheet and then tried using vb script but seems that I do not have admin rights to run the vb script. Is there any way to get the required output.

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

In your PUT() you use 8.

Use a date format instead, and it will show as you specify. Date9 is one option, though I wonder if that's a datetime field. If so, try datetime20.

View solution in original post

8 REPLIES 8
art297
Opal | Level 21

Couldn't you just put that value in a macro variable and then use it however you want to? 

You didn't say how you got the value. If it was with proc sql, just use into : to put it in a macro variable. If you got it via a datastep, use call symput.

 

Art, CEO, AnalystFinder.com

 

hk186002
Calcite | Level 5

Hi art297,

 

thank you very much for the reply. I will have a look into the function now and see how it goes.

 

I tried the below solution 

DATA date_3;
SET WORK.Maxlendnetdate;
CALL SYMPUT('maxdate',put(MAX_of_DATE_OF_EFFECT, 8.));

run;

FILENAME outbox EMAIL ("hari.kurupati@cba.com.au");
DATA _NULL_;
FILE outbox
TO=("hari.kurupati@cba.com.au")

SUBJECT=("Lendnet &maxdate ");
PUT "On &maxdate ";

RUN;

 

but I am getting the output as attached in the screenshot 

 

1.813E9 

 

I think there is some thing with format

 

Regards,

hari


output.jpg
Reeza
Super User

In your PUT() you use 8.

Use a date format instead, and it will show as you specify. Date9 is one option, though I wonder if that's a datetime field. If so, try datetime20.

hk186002
Calcite | Level 5
gotcha used datetime20. /....thanks :)))
Reeza
Super User

Why not include the single value as text in your email?

 

How would you include an excel document without attaching it in an actual email client? I'm not aware of a way....

hk186002
Calcite | Level 5

Hi Reeza,

 

thank for your reply. I am not sure abou this way as I am new to SAS. I tried searching through internet and also tried taking the inputs from art297 and I was able to find something

 

DATA date_3;
SET WORK.Maxlendnetdate;
CALL SYMPUT('maxdate',put(MAX_of_DATE_OF_EFFECT, 8.));

run;

FILENAME outbox EMAIL ("xxxxx.com.au");
DATA _NULL_;
FILE outbox
TO=("xxxxx.com.au")

SUBJECT=("Lendnet &maxdate ");
PUT "On &maxdate ";

RUN;

 

but getting some format issues with the date as shown in the attached.


output.jpg
kiranv_
Rhodochrosite | Level 12

your date is number, to precisely in float, . please use a date format something loke shown below, so that it displays as date

 

CALL SYMPUT(‘maxdate’, PUT( yourdate, MMDDYY6.));

Reeza
Super User

Is EG running on a server or your desktop? Either way you need to have the correct privileges to be able to do this. You should be able to send an email directly from SAS rather than use VB but it's also a viable option if you can't get it working for some reason.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 8 replies
  • 1016 views
  • 1 like
  • 4 in conversation