Usage Note 24322: Display the ORDER or GROUP variable value on every row with PROC REPORT
This note illustrates how to display the ORDER or GROUP variable value on every row with PROC REPORT.
If the GROUP or ORDER variable is character, then the blank row values in the column can be changed.
In a COMPUTE block, use an IF statement to check the row cell for a non-blank value and assign a DATA step variable that has that value. Use another IF statement to determine when the row cell is blank and reassign the DATA step variable value to it. To prevent the value from being repeated at the summary line, use an IF statement to check the value of the _BREAK_ variable.
proc report nowd data=sashelp.class;
column sex weight;
define sex / order;
compute sex;
if _break_ ne '_RBREAK_' then do;
if sex ne ' ' then hold=sex;
if sex eq ' ' then sex=hold;
end;
endcomp;
rbreak after / summarize;
run;
If the GROUP or ORDER variable is numeric, then a new variable needs to be created. Add a COMPUTED variable to the right of the GROUP or ORDER variable in the COLUMN statement.
In the COMPUTE block, use an IF statement to check the row cell for a non-blank value and assign a DATA step variable that has that value. Assign the DATA step variable value to the COMPUTED variable. Add a NOPRINT option to the DEFINE statement of the GROUP or ORDER variable. To prevent the value from being repeated at the summary line, use an IF statement to check the value of the _BREAK_ variable.
proc report nowd data=sashelp.class;
column age newage weight;
define age / order noprint;
define newage / computed 'AGE';
compute newage;
if _break_ ne '_RBREAK_' then do;
if age ne . then hold=age;
newage=hold;
end;
endcomp;
rbreak after / summarize;
run;
Operating System and Release Information
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
This note illustrates how to display the ORDER or GROUP variable value on every row with PROC REPORT.
Type: | Usage Note |
Priority: | low |
Topic: | SAS Reference ==> Procedures ==> REPORT
|
Date Modified: | 2007-12-17 11:11:02 |
Date Created: | 2005-07-29 10:28:20 |