LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (April 2003, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 11 Apr 2003 14:51:33 -0500
Reply-To:     "Workman, Rob" <Rob.Workman@CARBOMEDICS.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Workman, Rob" <Rob.Workman@CARBOMEDICS.COM>
Subject:      Re: SAS EMAIL in the if-then DO statement
Comments: To: "wollo_desse@HOTMAIL.COM" <wollo_desse@HOTMAIL.COM>
Content-Type: text/plain; charset="iso-8859-1"

Wollo-

Below is an example of one way to do what you are looking for. This example uses SCL style functions. Additionally, you might also explore using email directives, e.g. "!em_to!". Check out this link that was posted yesterday by Jim Hoffman for more information about using email directives:

http://ftp.sas.com/techsup/download/technote/ts605.html

Kind regards,

Rob Workman

data _null_; set sendit;

if state = 'AR' then do; rc = filename ( 'eml', 'nul', 'email', 'to = "Gomorak_Kassa@Yahoo.com"' || ' subject = "This is a file for AR"'|| ' attach = "c:\ar.txt" ' );

fid = fopen ('eml', 'a');

rc = fput (fid, 'This is a test for AR'); rc = fwrite (fid);

rc = fclose(fid); end;

else if state = 'TX' then do; rc = filename ( 'eml', 'nul', 'email', 'to = "Wollo_Desse@hotmail.com"' || ' subject = "This is a file for TX"'|| ' attach = "c:\tx.txt" ' );

fid = fopen ('eml', 'a');

rc = fput (fid, 'This is a test for TX'); rc = fwrite (fid);

rc = fclose(fid); end; run;

-----Original Message----- From: Action Man [mailto:wollo_desse@HOTMAIL.COM] Sent: Friday, April 11, 2003 2:08 PM To: SAS-L@LISTSERV.UGA.EDU Subject: SAS EMAIL in the if-then DO statemet

Hello Folks;

I am trying to send an Email to each state. But that is if the variable STATE = "TX" then send the email and attachment to "TX"; Look at the program I have tried and please tell me where I am having problem.

Libname Getit "c:\drive-d\StateFILEs";

Filename sendit email "Gomoraw_Kassa@Yahoo.com"; Data _Null_; File sendit; set getit.test; /* The file which contains States AR and TX */ If state = "AR" then do; to="Gomorak_Kassa@Yahoo.com" Subject="This is a file for AR" Attach="C:\AR.txt"; put "Test for AR"; end; else if state="TX" then do; to="Wollo_Desse@hotmail.com Subject="This is an Email for TX" Attach = "C:\TX.txt"; Put "Test for TX"; end; run;

_________________________________________________________________ Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail


Back to: Top of message | Previous page | Main SAS-L page