Date: Tue, 19 Oct 2004 11:34:01 -0700
Reply-To: David Fickbohm <DavidF@HOMEGAIN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: David Fickbohm <DavidF@HOMEGAIN.COM>
Subject: Re: How to put 2 or more datasets in 1 email sent from SAS
Content-Type: text/plain; charset="iso-8859-1"
People,
Here is the code I use to send multiple files to users via email.
ods listing;
filename myfile email EMailid = "MS Exchange Server"
to= ("xxxxx@xxxx.com","xxxx@xxxxxn.com")
cc=("davidf@xxxxx.com")
subject= "CG br conversion data sets -4- &sysdate."
type="text/plain"
attach=( "x\D\~\US\DAVEF\CG\OUTPUT\CG_brs_4_Oct03-&sysdate..xls",
"x\D\~\US\DAVEF\CG\OUTPUT\CG_brs_4_Nov03-&sysdate..xls",
"x\D\~\US\DAVEF\CG\OUTPUT\CG_brs_4_Sep04-&sysdate..xls",
"x\D\~\US\DAVEF\CG\OUTPUT\CG_brs_4_Oct04-&sysdate..xls",
"x\D\~\US\DAVEF\CG\OUTPUT\CG_brs_4_Nov04-&sysdate..xls");
data _null_;
file myfile;
put "Attached are the CG brs biweekly data sets.";
put " ";
put "If you have any questions, please let me know.";
put " ";
put "Thanks,";
put " ";
put "Dave F";
run;
quit;
The full path is important, a comma at the end of each line is very
important, the last instance must NOT have a comma. The closing parenthesis
can be on a separate line but must be present. Notice the filename after
"ods listing" and after "data _null_" are and must be the same.
Hope this helps
Dave
-----Original Message-----
From: Fehd, Ronald J. [mailto:RJF2@CDC.GOV]
Sent: Tuesday, October 19, 2004 8:08 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: How to put 2 or more datasets in 1 email sent from SAS
> From: Sieto Verver
> I want SAS to send an copy of 2 small datasets by email.
> These datasets differ in shape and variables. So far I manage
> to have SAS send me 1. (code shown below) Can any body help
> me how to include the second dataset? Many thanks in advance.
>
> FILENAME count email "me@email.com"
> subject="Error report";
> DATA _NULL_;
> SET base_err&i.;
> FILE count;
> PUT sample @@ @12 date @@ @25 date2 @@ @36 parameter
> @@ @49 value @@ @59 error //; RUN;
you'll want to read further in the documentation
about the attachment option of the filename email statement.
the trick is to know that multiple attachments
must be specified as a list:
which means that the names must be enclosed in parens:
attachment = ("data1" "data2")
if that is not the answer to your question
then you want to write from two datasets?
data _Null_;
do until(EndoFile1);
set File1
end = EndoFile1;
put ...;
end;
do until(EndoFile2);
set File2
end = EndoFile2;
put ...;
end;
stop;run;
Ron Fehd the enclosure maven CDC Atlanta GA USA RJF2 at cdc dot gov