@ballordw, Here is my Looper macro, just before caller.. ***checking whether any new entry for the onsetdt rslt endptid****; /*data final_1; merge final (in=a) test.History (in=b); by _all_; if a and not b; run;*/ ******relpacing the history file with current one****; data test.history; set final; run; ******creating macro variable for site and subject to creat the output for each subject; data _NULL_; set final_1 end=eof; call symput('pt'||compress(put(_n_,best.)),trim(left(upcase(subject)))); if eof then call symput('npts',compress(put(_n_,best.))); run; ****creating macro variable to create or run the report conditionally******; %let count=0; data _null_ ; set final_1 end=eof NOBS=COUNT;; countc = put(count,best.); if _n_ = 1 then call symput('count',countc); run; %put &count; %macro new_entry; %if &count ne 0 %then %do; *****genrating the report and sent patient profile in attached the mail if new entry****; *****selecting the subject only who have value for the endptid,event and onsetdt*****; proc sql; create table demo as select * from demog_1_ where subject in (select subject from final_1) order by subject,site; quit; ********************** Create profile for each patient*******************; %macro looper(subject=,); options papersize = A4 orientation = landscape nodate center nonumber bottommargin = 0.25in topmargin = 0.25in leftmargin = 0.25in rightmargin = 0.25in ; ods listing close; /*ods pdf body = "/ctshared/cdr/prod/a423_20110203/AMG423_20110203_Patient_Profile/rms32763/AMG423_20110203_&subject._Patient Profile.pdf";*/ ods pdf body = "/ctshared/cdr/dev/RAMYA/AMG423_20110203_&subject._Patient Profile.pdf"; ods noresults; footnote2 justify=left height=0.5 "Report Creation Date/Time: &sysdate. &systime. AM PDT" ; footnote3 justify=left height=0.5 "For Internal Use Only. Amgen Confidential."; Title1 Bold "AMG423_20110203_&subject._Patient Profile"; Title4 italic justify=left "Demographics"; PROC REPORT DATA=demo NOWD split='*' ; where subject in ("&subject" "Subject"); column ("Demographics" site subject age_y_c sex svstdt_raw); define site / Center Display "Site" style=[cellwidth=15mm]; define subject / Center Display "Subject" style=[cellwidth=22mm]; define age_y_c / Center Display "Age" style=[cellwidth=20mm]; define sex / Center Display "Sex" style=[cellwidth=20mm]; define svstdt_raw / Center Display "Screening Date" style=[cellwidth=20mm]; run; ods PDF close; /* must close tagsets.ExcelXP here*/ ods listing; ods results; ods listing; %mend looper ;
... View more