BookmarkSubscribeRSS Feed
mitrakos
Obsidian | Level 7

Hi Everyone,

 

I'm using PROC REPORT and I'm wondering how I would go about inserting a row with text above specific rows in the table generated. The text row is used as a separator for constructs that the survey uses that the report the generated for. Below is my code for the report as of now. 

 

proc report data = test_table headline COMPLETEROWS;
title 'Return of Results for SVA0901023';
columns NAME Rater_N Rater_Mean Rater_STD Rater_MIN Rater_MAX Rater_range Scholar_MEAN Difference;
define NAME / display 'Name' width = 10 format = $teamscience.;
define Rater_N / display 'Rater N' width = 2;
define Rater_Mean / analysis 'Rater Mean' format=8.1;
define Rater_STD / analysis 'Std Dev' format=8.1;
define Rater_MIN / analysis 'Rater Min' format = 8.1 noprint;
define Rater_MAX / analysis 'Rater Max' format = 8.1 noprint;
define Rater_range / computed 'Rater Range' format=8.1;
define Scholar_MEAN / analysis 'Scholar Rating' width = 10;
define Difference / computed 'Difference' format=8.1;
compute Rater_range;
	Rater_range = sum(Rater_MIN.sum,-1*Rater_MAX.sum);
endcomp;
compute Difference;
	Difference = sum(Rater_MEAN.sum,-1*Scholar_MEAN.sum);
	if Rater_MEAN.sum = . or Scholar_MEAN.sum = . then Difference = .;
endcomp;
run;

Any help would be appreciated. I'm specifically looking to insert a text row above row 1, 10, 15, 27, and 33. 

2 REPLIES 2
ballardw
Super User

Example data in the form of a data step.

 

Rules would have to be based on values in the data, not specific row numbers. That might mean adding a variable.

 

Proc Report has allows things like "compute before" or "compute after" with a Group or Order variable to do something before the first group of values or after a group of values.

If your variable Name was an ORDER variable instead of display you could use "compute before name;" to start a compute block that would execute before each group of values, or "compute after name;" to start a block that executes after the last data for each name.

 

Also, just what text to intend to insert? The LINE statement in a compute block would be one typical tool to divide sections of a report.

Cynthia_sas
SAS Super FREQ
Hi:
You will need to designate a variable to "break" on in a COMPUTE block, as @ballardw explained. Here's a user group paper https://support.sas.com/resources/papers/proceedings17/SAS0431-2017.pdf that shows all the possible "breaking" methods where you can write text: In particular, the example on page 8-9 shows using the LINE statement in all the possible COMPUTE blocks.
Cynthia

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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