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.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

SAS Enterprise Guide vs. SAS Studio

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.

SAS Training: Just a Click Away

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

Browse our catalog!

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