Date: Mon, 14 Apr 2003 15:50: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
Content-Type: text/plain; charset="iso-8859-1"
Wollo-
Another option is to use macros if that is more familiar to you. Here is an
example.
%macro eml(state);
%if &state = TX %then
%do;
filename SendTX Email "Gomoraw_Kassa@Hotmail.com";
data _null_;
file sendTX;
put 'test TX';
run;
%end;
%else %if &state = AR %then
%do;
filename SendAR Email "Wollo_Desse@hotmail.com";
data _null_;
file sendAR;
put 'test AR';
run;
%end;
%mend;
data _null_;
state = 'AR';
call execute('%eml('||upcase(state)||')');
run;
Rob
-----Original Message-----
From: Action Man [mailto:wollo_desse@hotmail.com]
Sent: Monday, April 14, 2003 2:24 PM
To: Rob.Workman@carbomedics.com
Subject: RE: SAS EMAIL in the if-then DO statement
Hi Rob;
Thank youfor your help, Some how whan I used your sample program, it was not
sending any message, it was just on "RUN" process for long time or it was
just hunged up when it reach that part. I also read the site you suggested,
but I am not able to understand SCL program at all.
What is rc=filename means?
If I have filename Sendit Email "Gomoraw_Kassa@Hotmail.com";
Shouldn't I say RC=sendit?
Could you helpme on this rutin please.
Than you,
Wollo
>From: "Workman, Rob" <Rob.Workman@carbomedics.com>
>To: "'wollo_desse@HOTMAIL.COM'" <wollo_desse@HOTMAIL.COM>, "sas-l (E-mail)"
><SAS-L@listserv.uga.edu>
>Subject: RE: SAS EMAIL in the if-then DO statement
>Date: Fri, 11 Apr 2003 14:51:33 -0500
>
>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/junkmai
_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail