Reeza, thanks for the new code, that is much easier and I can tell it will be easier to maintain.
So a couple of things... it is weird. If I change the loan format to a C it prints with a blank. If I change it back to an N, it prints. It is a char filed in my dataset so I am not sure why that would be the case.
As N:
As C:
Also, yesterday afternoon my boss came to me and wants me to add the lender name in the title as well. When I tried to create a new format for that, I get a big space in the file for it as well instead of the lender name. Here is my modified code that you provided me yesterday:
proc sort data=address out=address;
by pnc_loan_number;
run;
proc sort data=paytran out=paytran;
by pnc_loan_number;
run;
*add sequence numbers to mimic your structure;
data address;
set address;
by pnc_loan_number;
retain SeqNo;
if first.pnc_loan_number then
seqNo + 1;
run;
data paytran;
set paytran;
by pnc_loan_number;
retain SeqNo;
if first.pnc_loan_number then
seqNo + 1;
run;
*get max of seq for loop;
proc sql noprint;
select max(seqNo) into :NumObsadd from address;
quit;
*create format to map numbers to loan and lender;
proc sql;
create table mapSeq2loan as select distinct seqNo as Start, trim(pnc_loan_number) as
Label, 'loan_fmt' as fmtName, 'N' as type from address;
quit;
proc sql;
create table mapSeq2lender as select distinct seqNo as Start, trim(orig_lender) as
Label, 'lender_fmt' as fmtName, 'C' as type from address;
quit;
*create format;
proc format cntlin=mapSeq2loan;
run;
proc format cntlin=mapSeq2lender;
run;
*test mapping;
%put %sysfunc(putn(1, loan_fmt));
%put %sysfunc(putc(1, lender_fmt));
*macro to create reports;
%macro report_make();
%do i=1 %to &numObsadd;
ods pdf file="/sae/aal_labapm/01/mortgage/msracq/DEVELOPMENT/%sysfunc(putc(&i, lender_fmt))_history_epo_%sysfunc(putn(&i, loan_fmt)).pdf" style=htmlblue startpage=never bookmarklist=hide;
title "^S={font_size=14pt} LOAN HISTORY";
ods escapechar='^';
ods pdf text="^{style[just=left preimage='/sae/aal_labapm/01/mortgage/msracq/DEVELOPMENT/logo.jpg']}";
proc report data=work.address nowd;
where SeqNo = &i.;
by pnc_loan_number;
run;
proc report data=work.paytran nowd;
where SeqNo = &i.;
by pnc_loan_number;
run;
ods pdf close;
%end;
%mend report_make;
%report_make();
The results:
... View more