I am just starting out with SAS, and have a project to work on. I really do not know SAS very well at all, so please bear with me
I would like to send an e-mail only if there are no observations in a data set (cust2). If someone could tell me why an e-mail is always being sent regardless of the count of observations, I'd greatly appreciate it. On top of that, the e-mail is being sent with no message (body).
Also, it would be very helpful if anyone could point me to a website/book/other source where I can teach myself SAS.
The code for my current problem is below:
filename cust "/datatmp2/Customer Survey Raw Data.csv";
filename mail email ' '
TO = ("abc@123.com")
FROM = ("123@abc.com")
SUBJECT = "[Test] 11/30";
data cust; infile cust dlm='~' dsd truncover missover firstobs=2;
input A B: $10. C: $10. D: $25. E: $1. F: $1. G: $1. H: $500.;
run;
data cust; set cust;
newAformatted = put(mdy(01,01,1900)+A-2,date9.);
newA = mdy(01,01,1900)+A-2;
run;
proc sql;
create table cust2 as
select *
from cust
where newA >= mdy(11,30,2009);
run;
data _null_;
dsid = open('cust2','i');
n_obs = attrn(dsid,'nobs');
if n_obs = 0 then
do;
file mail;
put "This is a test."; put n_obs;
end;
run;
I would like to send an e-mail only if there are no observations in a data set (cust2). If someone could tell me why an e-mail is always being sent regardless of the count of observations, I'd greatly appreciate it. On top of that, the e-mail is being sent with no message (body).
Also, it would be very helpful if anyone could point me to a website/book/other source where I can teach myself SAS.
The code for my current problem is below:
filename cust "/datatmp2/Customer Survey Raw Data.csv";
filename mail email ' '
TO = ("abc@123.com")
FROM = ("123@abc.com")
SUBJECT = "[Test] 11/30";
data cust; infile cust dlm='~' dsd truncover missover firstobs=2;
input A B: $10. C: $10. D: $25. E: $1. F: $1. G: $1. H: $500.;
run;
data cust; set cust;
newAformatted = put(mdy(01,01,1900)+A-2,date9.);
newA = mdy(01,01,1900)+A-2;
run;
proc sql;
create table cust2 as
select *
from cust
where newA >= mdy(11,30,2009);
run;
data _null_;
dsid = open('cust2','i');
n_obs = attrn(dsid,'nobs');
if n_obs = 0 then
do;
file mail;
put "This is a test."; put n_obs;
end;
run;