Thanks ledfoot, But here's what Alex from stackoverflow suggested it breaks the ID sometimes when it hits the 3000 length because I have more than 60000 records which I do not know how to resolve and also there is another dataset workgo.recs_not_processed which I have to print in the same way in the same email. The output is breaking the ID's which should be avoided and below this I should add recs not processed= and the id's not processed= recs processed=60 awd_id's 123456,456789,123890,123 890,453212,555555,9231 43 %include '/saswrk/go/scripts/envsetup.sas'; filename mymail email "&emaillist" subject = "&env Records Transferred on %sysfunc(date(), yymmdd10.)"; data _null_; length id_list $ 3000; retain id_list ''; set workgo.recds_processed nobs = nobs end = eof; file mymail; if _n_ = 1 then do; put 'Number of records processed=' nobs; put 'The IDs are:'; end; /* Print the IDs in chunks */ if length(strip(id_list)) > 2000 then do; put id_list; call missing(id_list); end; call catx(', ', id_list, id); if eof then put id_list; run;
... View more