Dear all,
I want to print an extra line BETWEEN groups.
When I use COMPUTE AFTER groupx this will work BUT the line will also be printed at the end of the report (after the last group)!!
And that is not what I want.
I tried something like:
COMPUTE after prod_cl;
PROD='TOTAL' ;
IF prod_cl='EXTERNAL2' then do;
line " ";
line " ";
line "--Not included above--" ;
end;
ENDCOMP;
but the IF is ignored and the line statement is always executed.....
any suggestions ??
Regards,
Herman
Yes, LINE statements are always executed even when they're within the scope of an IF or DO. LINE statement behavior is counter-intutitive (to say the least). When PROC REPORT executes a COMPUTE block, it first removes all the LINE statements, then executes the remaining code, and only then executes the LINE statements in the order they appear in the COMPUTE block. See the Restriction here.
However, this SAS note describes a clever trick that allows a LINE statement to appear to be conditionally executed.
Yes, LINE statements are always executed even when they're within the scope of an IF or DO. LINE statement behavior is counter-intutitive (to say the least). When PROC REPORT executes a COMPUTE block, it first removes all the LINE statements, then executes the remaining code, and only then executes the LINE statements in the order they appear in the COMPUTE block. See the Restriction here.
However, this SAS note describes a clever trick that allows a LINE statement to appear to be conditionally executed.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.