BookmarkSubscribeRSS Feed
sunilreddy
Fluorite | Level 6

%macro increaseSlideNo();
  %let slideNo = %sysfunc(putn(%eval(&slideNo + 1),z03.));
%mend increaseSlideNo;

To fulfil for one my requirement, I've to use below title and macro statements in each page break in proc report.

title  "#6A&slideNo.#SUMMARY REPORT"; 

%increaseSlideNo;

would it be possible to use above two statements in page break in proc report


2 REPLIES 2
Cynthia_sas
SAS Super FREQ

Hi:

  A SAS TITLE statement can only get issued BETWEEN procedure steps. That is your only opportunity to change the SAS TITLE. Without seeing the code for how you are generating the page break in PROC REPORT (using BY, using PAGE on BREAK??), it is hard to make a constructive comment. If you were using BY group processing, it is possible to use the special BY variables to get the title to change for a BY group.

  PROC REPORT does have the COMPUTE block, you could try COMPUTE BEFORE _PAGE_ -- but the text is within the boundary of the table, not at the top of the physical page. You did not say what your destination of interest was. You did not show any code other than your TITLE statement.

  Also, you did not show what is "inside" the %increaseSlideNo macro program -- for example, if there were only macro statement inside the macro program it might work. However, if there were an entire DATA step program or a PROC SQL step or any other procedure step inside the macro program, you cannot have the macro program generate any statements that would force a step boundary in PROC REPORT.

  For example, compare the placement of a BY variable in the title compared to the placement of the AGE value (coming from the COMPUTE BEFORE _PAGE_) in the attached screenshot.

cynthia

proc sort data=sashelp.class out=class;

by age sex name;

where age in (13, 14, 15);

run;

    

options nobyline nodate nonumber;

ods listing close;

    

ods html file='c:\temp\class.html';

ods rtf file='c:\temp\class.rtf';

ods pdf file='c:\temp\class.pdf';

   

proc report data=class nowd;

  title 'From BY Processing: Age is #Byval1';

  by age;

  column age sex name height weight;

  define age / group noprint;

  define sex / order;

  define name / order;

  define height / display;

  define weight / display;

  break after age / page;

  compute before _page_ /

          style={just=c font_weight=bold};

    disp_line = "From Compute Block Age is:"||trim(put(age,2.0))||" Summary Report";

    line disp_line $50.;

  endcomp;

run;

 

ods _all_ close;

title;

options byline;


compare_compute_vs_byval_title.png
smitkshah
Calcite | Level 5

Hi,

 

I am having similar issue. I need to put different lab paramter name on left corner of page and it is different page by page. by variable in proc report doesn't work for me as I can't sort it by parameter. Is there any other way I can create only parameter name ? Also is there anyway I can create variable or can use any option in compute after or break after statement  which will leave blank space after every 5 lines? Really Appreciate your help.

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 2 replies
  • 2904 views
  • 0 likes
  • 3 in conversation