SAS Base Dataset作为电子邮件正文输出

时间:2015-06-01 00:37:12

标签: email dependency-injection sas base

我有2个大型SAS数据集,其中包含65000个ID。我想发送一封带有','作为分隔符的电子邮件。

SASDATASETNAME.ID_PROCESSED
ID
1
2
3
.
.
65000

SASDATASETNAME.ID_NOT_PROCESSED
ID
a
b

OUTPUT IN ONE EMAIL WITH BODY NEEDS TO BE 
Number of ID's processed=65000
1,2,3,4..
.
.
65000

Number of ID's not processed=2
a,b

1 个答案:

答案 0 :(得分:0)

data b;
length one_char $ 1;
do i=1 to 100000;
    one_char=byte(int(25*ranuni(0)+65)); *** return an uppercase character;
    output;
end;
run;

data b;
length one_char $ 1;
do i=1 to 100000;
    one_char=byte(int(25*ranuni(0)+65)); *** give me an uppercase character;
    output;
end;
run;

data c;
length one_char $ 1;
do i=1 to 100000;
    one_char=byte(int(25*ranuni(0)+65)); *** give me an uppercase character;
    output;
end;
run;


/*** assuming that you have an SMTP server available and SAS is configured to use it */
filename mymail email "your.name@somesite.com"
subject="whatever you'd like to put in the subject line";


data _null_; 
length concatenated $ 32676;
retain _linelength 200;
file mymail;
if _n_ = 1 then do;
    put 'Hi there!' /;
put;
end;
concatenated = '';
put / 'Dataset B' /;
do while(not blast);
    set b end=blast;
    concatenated = strip(concatenated) || ',' || one_char;
    if length(concatenated) > _linelength or blast then do;
        concatenated = substr(concatenated,2);
        put concatenated;
        concatenated='';
    end;
end;
concatenated = '';
put / 'Dataset C' /;
do while(not clast);
    set c end=clast;
    concatenated = strip(concatenated) || ',' || one_char;
    if length(concatenated) > _linelength or clast then do;
        concatenated = substr(concatenated,2);
        put concatenated;
        concatenated='';
    end;
end;
stop;
run;