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

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 422 views
  • 0 likes
  • 3 in conversation