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.
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.
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 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.
Ready to level-up your skills? Choose your own adventure.