I would recommend backing up and starting straight from your reporting code and follow the tutorial.
The code posted in the forum thus far was sticking with your approach it was not following the tutorial.
Taking your code and refactoring it use the tutorial, this should work, assuming your reporting code is correct.
%macro generate_report(seqNo = , loanID = , orig_lender = );
ods pdf file="/sae/aal_labapm/01/mortgage/msracq/DEVELOPMENT/&orig_lender._history_epo_&loanID..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 = &seqNo.;
by pnc_loan_number;
run;
proc report data=work.paytran nowd;
where SeqNo = &seqNo.;
by loan_number;
run;
ods pdf close;
%mend generate_report;
proc sql;
create table mapSeq as
select distinct
seqNo as Start
, trim(loan_number) as loan_number
, trim(lender) as orig_lender
from address;
quit;
*can be a data _null_ step instead but I leave it as a dataset for debugging initially;
data execute_reports;
set mapSeq;
str = catt('%generate_report(seqNo=',
seqNo,
' ,loanID = ',
loanID,
' ,orig_lender = ',
orig_lender,
');'
);
*Uncomment this line once you are sure the string is being generated correctly;
*call execute(str);
run;
Wooo hooo! It worked! Everything makes sense now that it is all in the proper order to run correctly. I don't know you personally but I love you. 😁
I do have one question that I am curious about. Why is there so much space in the str variable between each of the variables I set?
data execute_reports;
set mapSeq;
str = catt('%generate_report(seqNo=', seqNo, ' ,loan_number = ', loan_number, ' ,orig_lender = ', orig_lender, ');' );
Ah, gotcha.
Thank you again for the time you spent helping me out. I am now on the right track. I hope this can help someone else too.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.