Desktop productivity for business analysts and programmers

Sending the column value in excel to email( Not as attachement)

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 13
Accepted Solution

Sending the column value in excel to email( Not as attachement)

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.


Accepted Solutions
Solution
‎06-13-2017 10:46 PM
Grand Advisor
Posts: 17,325

Re: Sending the column value in excel to email( Not as attachement)

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


All Replies
Esteemed Advisor
Posts: 7,290

Re: Sending the column value in excel to email( Not as attachement)

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

 

Occasional Contributor
Posts: 13

Re: Sending the column value in excel to email( Not as attachement)

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

Attachment
Solution
‎06-13-2017 10:46 PM
Grand Advisor
Posts: 17,325

Re: Sending the column value in excel to email( Not as attachement)

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.

Occasional Contributor
Posts: 13

Re: Sending the column value in excel to email( Not as attachement)

gotcha used datetime20. /....thanks Smiley Happy))
Grand Advisor
Posts: 17,325

Re: Sending the column value in excel to email( Not as attachement)

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

Occasional Contributor
Posts: 13

Re: Sending the column value in excel to email( Not as attachement)

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.

Attachment
Regular Contributor
Posts: 227

Re: Sending the column value in excel to email( Not as attachement)

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.));

Grand Advisor
Posts: 17,325

Re: Sending the column value in excel to email( Not as attachement)

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.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

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