BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Reeza
Super User

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;
elwayfan446
Barite | Level 11

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,             ');'           );

 

 

Reeza
Super User
The editor messed up the alignment, I had a part on each line because it makes it easier to ensure that the quotes and commas are in the correct place.
elwayfan446
Barite | Level 11

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.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 33 replies
  • 3903 views
  • 0 likes
  • 4 in conversation