BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Diana_K
Calcite | Level 5

Hello,

 

I have a report where I have introduced one blank line after each section, however my last observation crosses the next page because of the empty line the report adds after that last observation.

Practically my last observation is the last section and now I am left with 1 row on the second page

 

Is there a way to condition this compute after, for it not to compute after the last observation?

 

compute after group;
line @1 "";
endcomp;

 

I've tried writing the number of observations (which is 26) in my dataset, and using it as a macro variable but now the whole empty line disappears, something like this.

 

%if &nobs. lt 26 %then %do;
compute after group;
line @1 "";
endcomp;
%end;

 

Thank you!

Diana

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

As a minimum share the entire Procedure code. Interactions of options and define are needed.

Best is to copy your entire procedure code and then paste it into text or code box opened on the forum with the </> or "running man" icons that appear above the message window.

The message windows on this forum will reformat pasted text and sometimes result in code that will not run because of inserted HTML character. Plus the box makes it clearer which is code and which is question. An example:

 

Proc print data=sashelp.class noobs;
   var name age;
run;

View solution in original post

3 REPLIES 3
ballardw
Super User

As a minimum share the entire Procedure code. Interactions of options and define are needed.

Best is to copy your entire procedure code and then paste it into text or code box opened on the forum with the </> or "running man" icons that appear above the message window.

The message windows on this forum will reformat pasted text and sometimes result in code that will not run because of inserted HTML character. Plus the box makes it clearer which is code and which is question. An example:

 

Proc print data=sashelp.class noobs;
   var name age;
run;
Diana_K
Calcite | Level 5

Hello,

 

Thank you for the reply.

 

I am working on sensitive data and with a lot of internal macros I can't share and I was trying to avoid having to blind the information, thought my question was clear, I apologize 🙂

 

Please see below the output dataset, I need one empty line in the RTF report after each GROUP value, except for the last value, so no empty line after GROUP=7.

 

Please note nothing can be changed to the page layout, it's a standard and I can't update the widths for anything related to the footers and titles.

 

Diana_K_0-1673608405910.png

 

Hope this is enough, if not I will remove the question since I can't add anything more.

 

Thankyou

Diana

 

Ksharp
Super User
/*
You could remove the last blank row by format $varying.
Like this:
*/
ods rtf file='c:\temp\temp.rtf';
proc report data=sashelp.class nowd;
define name/display;
define age/group;
compute before age;
n+1;
if n=1 then len=0;
 else len=20;
x=' ';
line x $varying20. len;
endcomp;
run;
ods rtf close;

Ksharp_0-1673613038039.png

 

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

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