Hello everyone, I would like to check the record length of a dataset and if the record length > 0 , then email the data of the dataset in an email. Any idea how I can achieve this? specifically, i need to know how to use if..then...else to attach a particular file Thank you for your help. Regards %let file1 = "C:\sasdata\Output\delta\ &RepDate.deltaProdFile.csv"; %let file2 = "C:\sasdata\Output\delta\ &RepDate.deltaStatusFile.csv"; %macro nobs(ds); %let DSID=%sysfunc(OPEN(&ds.,IN)); %let NOBS=%sysfunc(ATTRN(&DSID,NOBS)); %let RC=%sysfunc(CLOSE(&DSID)); &NOBS %mend; %let total_rec1 = %nobs(WORK.DATASET1); /* This has been output to file1 */ %let total_rec2 = %nobs(WORK.DATASET2); /* This has been output to file2 */ /* Emailing the file */ filename mymail email to = ('myemail@hostname.com' ) subject= "ATTACHMENT TEST" attach= (&file1. &file2.) ; data _null_; file mymail; put "Auto message generated from SAS - Do Not Reply..."; run;
... View more