<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Proc REPORT Compute Block - Attempt to fill in cells below Group values does not work in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-REPORT-Compute-Block-Attempt-to-fill-in-cells-below-Group/m-p/979363#M378783</link>
    <description>&lt;P&gt;Post a desired output would be better to explain your question.&lt;/P&gt;
&lt;P&gt;You want this ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
input ID $ Level $ Count Duration Duration_YTD ;
Duration_YTD2 = Duration_YTD ;
datalines ;
Owl YTD 1 20  20
Emu YTD 11  200 200
Jay YTD 12  100 100
Hen YTD 13  300 300
Spy YTD 6 80  80
Auk YTD 7 500 500
Tui YTD 8 60  60
Kea YTD 4 140 140
Fin YTD 6 80  80
Mew YTD 12  70  70
Owl DayX  0 0 20
Emu DayX  3 3 200
Jay DayX  2 4 100
Hen DayX  1 8 300
Spy DayX  1 6 80
Auk DayX  2 7 500
Tui DayX  4 9 60
Kea DayX  1 0 140
Fin DayX  1 0 80
Mew DayX  2 2 70
;
data cntlin ;
infile datalines dlm=',' ;
length FmtName $32 Start End 8 Label $10 ;
input FmtName Start End Label ;
datalines ;  
DurationSize,1,59,S 
DurationSize,60,179,M 
DurationSize,180,5000,L 
DurationRange,1,59,&amp;lt; 60  
DurationRange,60,179,&amp;lt; 180 
DurationRange,180,5000,&amp;gt;= 180 
;

proc format cntlin=cntlin ;
run ;


proc report box data=have  nowd out=x; 
  title "Columns under YTD are group" ;
  title2 "Cells subsequent to new group value are blank, despite COMPUTE block" ;
  column ('YTD' Duration_YTD  Duration_YTD2 YTD YTD2) Level Count Count=Count_repeat ;
  define Duration_YTD  /noprint group order=internal width=6 format=DurationSize.  'size'  ;
  define Duration_YTD2 /noprint group order=internal width=6 format=DurationRange. 'range' ;
  define YTD  /computed width=6 format=DurationSize.  'size'  ;
  define YTD2 /computed width=6 format=DurationRange. 'range' ;

  define Level             / group ;
  define Count             / Analysis Sum ;
  define Count_repeat      / Analysis N ;

  compute YTD2;
    if not missing(Duration_YTD) then _YTD=Duration_YTD;
	YTD=_YTD;
    if not missing(Duration_YTD2) then _YTD2=Duration_YTD2;
    YTD2=_YTD2;
  endcomp;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1763793762307.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/111502i14D23B353B0AFED5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1763793762307.png" alt="Ksharp_0-1763793762307.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 22 Nov 2025 06:42:55 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2025-11-22T06:42:55Z</dc:date>
    <item>
      <title>Proc REPORT Compute Block - Attempt to fill in cells below Group values does not work</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-REPORT-Compute-Block-Attempt-to-fill-in-cells-below-Group/m-p/979361#M378782</link>
      <description>&lt;P&gt;In the following example I would like the merged empty cells in the Proc REPORT output to be filled in with the current group value.&lt;/P&gt;
&lt;P&gt;In ODS LISTING the cells of a repeated group value appear to be always spanned (SPANROWS )&lt;/P&gt;
&lt;P&gt;In HTML, SPANROWS has to be turned as a Proc REPORT option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
input ID $ Level $ Count Duration Duration_YTD ;
Duration_YTD2 = Duration_YTD ;
datalines ;
Owl YTD 1 20  20
Emu YTD 11  200 200
Jay YTD 12  100 100
Hen YTD 13  300 300
Spy YTD 6 80  80
Auk YTD 7 500 500
Tui YTD 8 60  60
Kea YTD 4 140 140
Fin YTD 6 80  80
Mew YTD 12  70  70
Owl DayX  0 0 20
Emu DayX  3 3 200
Jay DayX  2 4 100
Hen DayX  1 8 300
Spy DayX  1 6 80
Auk DayX  2 7 500
Tui DayX  4 9 60
Kea DayX  1 0 140
Fin DayX  1 0 80
Mew DayX  2 2 70
;
data cntlin ;
infile datalines dlm=',' ;
length FmtName $32 Start End 8 Label $10 ;
input FmtName Start End Label ;
datalines ;  
DurationSize,1,59,S 
DurationSize,60,179,M 
DurationSize,180,5000,L 
DurationRange,1,59,&amp;lt; 60  
DurationRange,60,179,&amp;lt; 180 
DurationRange,180,5000,&amp;gt;= 180 
;

proc format cntlin=cntlin ;
run ;

proc print data=have ;
  format Duration_YTD DurationSize. ;
  format Duration_YTD2 DurationRange. ;
run ;

options linesize=100 nocenter nodate nonumber formdlim=' ' ;

proc tabulate data=have ;
  class Duration_YTD Duration_YTD2 Level ;
  var Count ;
  format Duration_YTD DurationSize. ;
  format Duration_YTD2 DurationRange. ;
  table 
    Duration_YTD
    * Duration_YTD2
      * Level
  ,
    Count * (Sum * f=5. N * f=4.)
  / rts=40
  ;
run;

proc report box data=have ;
  title "Columns under YTD are group" ;
  title2 "Cells subsequent to new group value are blank" ;
  column ('YTD' Duration_YTD Duration_YTD2) Level Count Count=Count_repeat ;
  define Duration_YTD  / group order=internal width=6 format=DurationSize.  'size'  ;
  define Duration_YTD2 / group order=internal width=6 format=DurationRange. 'range' ;
  define Level             / group ;
  define Count             / Analysis Sum ;
  define Count_repeat      / Analysis N ;
run;

proc report box data=have ;
  title "Columns under YTD are group" ;
  title2 "Cells subsequent to new group value are blank, despite COMPUTE block" ;
  column ('YTD' Duration_YTD Duration_YTD2) Level Count Count=Count_repeat ;
  define Duration_YTD  / group order=internal width=6 format=DurationSize.  'size'  ;
  define Duration_YTD2 / group order=internal width=6 format=DurationRange. 'range' ;
  define Level             / group ;
  define Count             / Analysis Sum ;
  define Count_repeat      / Analysis N ;
  compute Duration_YTD ;
    if not missing(Duration_YTD) then hold = Duration_YTD ;
    if     missing(Duration_YTD) then Duration_YTD = hold ;
  endcomp ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
Tabulate

---------------------------------------------------
|                                      |  Count   |
|                                      |----------|
|                                      | Sum | N  |
|--------------------------------------+-----+----|
|Duration_YTD|Duration_YT-|Level       |     |    |
|------------|D2          |            |     |    |
|S           |------------+------------|     |    |
|            |&amp;lt; 60        |DayX        |    0|   1|
|            |            |------------+-----+----|
|            |            |YTD         |    1|   1|
|------------+------------+------------+-----+----|
|M           |&amp;lt; 180       |DayX        |   11|   6|
|            |            |------------+-----+----|
|            |            |YTD         |   48|   6|
|------------+------------+------------+-----+----|
|L           |&amp;gt;= 180      |DayX        |    6|   3|
|            |            |------------+-----+----|
|            |            |YTD         |   31|   3|
---------------------------------------------------
 
                                                                                                    
 
REPORT: Columns under YTD are group
Cells subsequent to new group value are blank

  ------------------------------------------------
  |     YTD                                      |
  |  size   range  Level         Count      Count|
  |----------------------------------------------|  
  |     S| &amp;lt; 60  | DayX    |         0|         1|  
  |      |       |---------+----------+----------|  
  |      |       | YTD     |         1|         1|  
  |------+-------+---------+----------+----------|  
  |     M| &amp;lt; 180 | DayX    |        11|         6|  
  |      |       |---------+----------+----------|  
  |      |       | YTD     |        48|         6|  
  |------+-------+---------+----------+----------|  
  |     L| &amp;gt;= 180| DayX    |         6|         3|  
  |      |       |---------+----------+----------|  
  |      |       | YTD     |        31|         3|  
  ------------------------------------------------  
 
                                                                                                    
 
REPORT: Columns under YTD are group
Cells subsequent to new group value are blank, despite COMPUTE block

  ------------------------------------------------
  |     YTD                                      |
  |  size   range  Level         Count      Count|
  |----------------------------------------------|  
  |     S| &amp;lt; 60  | DayX    |         0|         1|  
  |      |       |---------+----------+----------|  
  |      |       | YTD     |         1|         1|  
  |------+-------+---------+----------+----------|  
  |     M| &amp;lt; 180 | DayX    |        11|         6|  
  |      |       |---------+----------+----------|  
  |      |       | YTD     |        48|         6|  
  |------+-------+---------+----------+----------|  
  |     L| &amp;gt;= 180| DayX    |         6|         3|  
  |      |       |---------+----------+----------|  
  |      |       | YTD     |        31|         3|  
  ------------------------------------------------  &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The HTML is showing blank cells when group value would have repeated.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RichardAD_0-1763789760663.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/111501i0713B9C664A30F08/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RichardAD_0-1763789760663.png" alt="RichardAD_0-1763789760663.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;My attempt to force the repeated using a COMPUTE block did not work.&lt;BR /&gt;&lt;BR /&gt;Is there a technique or option to force the group value to repeat?&lt;/P&gt;</description>
      <pubDate>Sat, 22 Nov 2025 05:39:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-REPORT-Compute-Block-Attempt-to-fill-in-cells-below-Group/m-p/979361#M378782</guid>
      <dc:creator>RichardAD</dc:creator>
      <dc:date>2025-11-22T05:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: Proc REPORT Compute Block - Attempt to fill in cells below Group values does not work</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-REPORT-Compute-Block-Attempt-to-fill-in-cells-below-Group/m-p/979363#M378783</link>
      <description>&lt;P&gt;Post a desired output would be better to explain your question.&lt;/P&gt;
&lt;P&gt;You want this ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
input ID $ Level $ Count Duration Duration_YTD ;
Duration_YTD2 = Duration_YTD ;
datalines ;
Owl YTD 1 20  20
Emu YTD 11  200 200
Jay YTD 12  100 100
Hen YTD 13  300 300
Spy YTD 6 80  80
Auk YTD 7 500 500
Tui YTD 8 60  60
Kea YTD 4 140 140
Fin YTD 6 80  80
Mew YTD 12  70  70
Owl DayX  0 0 20
Emu DayX  3 3 200
Jay DayX  2 4 100
Hen DayX  1 8 300
Spy DayX  1 6 80
Auk DayX  2 7 500
Tui DayX  4 9 60
Kea DayX  1 0 140
Fin DayX  1 0 80
Mew DayX  2 2 70
;
data cntlin ;
infile datalines dlm=',' ;
length FmtName $32 Start End 8 Label $10 ;
input FmtName Start End Label ;
datalines ;  
DurationSize,1,59,S 
DurationSize,60,179,M 
DurationSize,180,5000,L 
DurationRange,1,59,&amp;lt; 60  
DurationRange,60,179,&amp;lt; 180 
DurationRange,180,5000,&amp;gt;= 180 
;

proc format cntlin=cntlin ;
run ;


proc report box data=have  nowd out=x; 
  title "Columns under YTD are group" ;
  title2 "Cells subsequent to new group value are blank, despite COMPUTE block" ;
  column ('YTD' Duration_YTD  Duration_YTD2 YTD YTD2) Level Count Count=Count_repeat ;
  define Duration_YTD  /noprint group order=internal width=6 format=DurationSize.  'size'  ;
  define Duration_YTD2 /noprint group order=internal width=6 format=DurationRange. 'range' ;
  define YTD  /computed width=6 format=DurationSize.  'size'  ;
  define YTD2 /computed width=6 format=DurationRange. 'range' ;

  define Level             / group ;
  define Count             / Analysis Sum ;
  define Count_repeat      / Analysis N ;

  compute YTD2;
    if not missing(Duration_YTD) then _YTD=Duration_YTD;
	YTD=_YTD;
    if not missing(Duration_YTD2) then _YTD2=Duration_YTD2;
    YTD2=_YTD2;
  endcomp;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1763793762307.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/111502i14D23B353B0AFED5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1763793762307.png" alt="Ksharp_0-1763793762307.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Nov 2025 06:42:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-REPORT-Compute-Block-Attempt-to-fill-in-cells-below-Group/m-p/979363#M378783</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-11-22T06:42:55Z</dc:date>
    </item>
  </channel>
</rss>

