02-01-2013 09:56 AM
Hi - when you specify a column as either 'Order' or 'Group', is there an option on the DEFINE statement to have the values repeat for every line, instead of once at the start of the group?
02-01-2013 11:29 AM
Here is how I do it, which is probably wrong.
02-02-2013 12:16 AM
You are exactly correct. There is NOT an option on the DEFINE statement to have an ORDER or GROUP variable repeat on every row. The PROC REPORT "suppression" behavior is by design. Having only the first of the group appear and and having the other rows blank is the way that ORDER and GROUP have always behaved. So, if you want the value to repeat on every row, you have to essentially save the first value of the group into a temporary variable, then make a computed variable to hold the value on every row and give it the value of the temporary variable. Then you use NOPRINT on the "true" ORDER or GROUP variable.
Your example was great. Starting in SAS 9.2, there was a new option, SPANROWS that makes ORDER or GROUP items have spanning rows (like TABULATE). Check this out (with ODS). The row area for SEX now spans the rows for NAME.
The only change I made was to take out the BREAK AFTER statement. Sometime between ODS in SAS 7 and SAS 9, you can do a COMPUTE AFTER on an ORDER or GROUP variable without necessarily needing a BREAK, especially if all you want is the LINE from the COMPUTE. You would need the BREAK for SUMMARIZE, though.
So, nice job.
ods html file='c:\temp\spanrows.html';
proc report data=sashelp.class nowd list spanrows;
columns sex name;
define sex / order;
define name / display;
compute after sex;
line ' ';
ods html close;