-1

extra line

I want to insert a new line after a group of every br variable but not when br=10 in proc report.

I have the compute code written as below, but the if condition does not seem to work

compute after br/ style={borderrightwidth=2 bordertopwidth=1 borderleftwidth=2};
if br in (1,2,3,4,5,6,7,8,9) then do;
line ' ';
end;
endcomp;

How do it remove the blank line at the very end?

sria
  • 35
  • 2
  • 10

1 Answers1

1

The LINE statement in Proc REPORT is performed unconditionally.

From SAS Help

LINE Statement

Provides a subset of the features of the PUT statement for writing customized summaries.

Restrictions:
This statement is valid only in a compute block that is associated with a location in the report.
You cannot use the LINE statement in conditional statements (IF-THEN, IF-THEN/ELSE, and SELECT) because it is not executed until PROC REPORT has executed all other statements in the compute block.

You can ensure the output from LINE contains a blank value for the 10th group.

data have;
  do mygroup = 1 to 10;
    do seq = 1 to 5;
      x = mygroup * 100 + seq;
      output;
    end;
  end;
run;

ods html close;
ods html;

proc report data=have;
  define mygroup / order;

  compute after mygroup / style={borderrightwidth=12 bordertopwidth=11 borderleftwidth=12};
    length text $200;
    if mygroup in (1,2,3,4,5,6,7,8,9) then do;
      text = 'line from compute after mygroup.  mygroup=' || put(mygroup,2.-L);
    end;
    else
      text = ' ';

    line text $char200.;
  endcomp;
run;
Richard
  • 25,390
  • 3
  • 25
  • 38