<?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: Methods to hide rows in PROC TABULATE in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Methods-to-hide-rows-in-PROC-TABULATE/m-p/927001#M364837</link>
    <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I thought it would be possible with MLF, but I was stuck on the idea of using CLASSDATA to select the rows to display, forgetting that you can do it with preloadfmt order=data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I like the MLF approach, and was planning to use a macro to build the format anyway.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you'd like to show your SQL approach, I'd be happy to see it.&amp;nbsp; But for my real problem I'll probably stick with TABULATE, since the real table is more complex, with different statistics calculated by TABULATE, trafficlighting, etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And sorry for not responding sooner. I somehow missed the notification when you responded.&amp;nbsp; Luckily I got the reminder email today that said "you got responses."&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 04 May 2024 11:55:03 GMT</pubDate>
    <dc:creator>Quentin</dc:creator>
    <dc:date>2024-05-04T11:55:03Z</dc:date>
    <item>
      <title>Methods to hide rows in PROC TABULATE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Methods-to-hide-rows-in-PROC-TABULATE/m-p/926548#M364610</link>
      <description>&lt;P&gt;Wondering about methods to hide a row in PROC TABULATE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Suppose I have a simple table with DATE in rows, PASS in column and have a total row.&amp;nbsp; So daily data for April like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
  do date='01Apr2024'd to '30Apr2024'd ;
    do id=1 to 5 ;
      pass=ranuni(9)&amp;lt;.3 ;
      output ;
    end ;
  end ;
  format date date9. ;
run ;

proc tabulate data=have;
  class date pass ;
  tables (date all),pass ;
run ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I want to make that table, but show only the rows for Apr 24 -Apr 30, and the ALL row.&amp;nbsp; &lt;EM&gt;But I want the ALL row to reflect all 30 days, even though the table only shows rows for 7 days.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In my mind, I want the table as above, but just hide the rows for Apr 1 - Apr 23.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My first thought is to extend my data to have data as is for April 24-30, and then output all the rows again with date set to some arbitrary value that I can use to make an "ALL" row.&amp;nbsp; So something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  set have ;
  if date&amp;gt;='24Apr2024'd then output ;
  date='09Sep2099'd ;
  output ;
run ;

proc format ;
  value datef
  '09Sep2099'd='01Apr2024 - 30Apr2024'
  other=[date9.]
  ;
run ;

proc tabulate data=want;
  class date pass ;
  tables date,pass ;
  format date datef. ;
run ;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;That works and gives me the desired output:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt; ----------------------------------------------------------
 |                              |          pass           |
 |                              |-------------------------|
 |                              |     0      |     1      |
 |                              |------------+------------|
 |                              |     N      |     N      |
 |------------------------------+------------+------------|
 |date                          |            |            |
 |------------------------------|            |            |
 |24APR2024                     |        3.00|        2.00|
 |------------------------------+------------+------------|
 |25APR2024                     |        3.00|        2.00|
 |------------------------------+------------+------------|
 |26APR2024                     |        4.00|        1.00|
 |------------------------------+------------+------------|
 |27APR2024                     |        3.00|        2.00|
 |------------------------------+------------+------------|
 |28APR2024                     |        5.00|           .|
 |------------------------------+------------+------------|
 |29APR2024                     |        4.00|        1.00|
 |------------------------------+------------+------------|
 |30APR2024                     |        4.00|        1.00|
 |------------------------------+------------+------------|
 |01Apr2024 - 30Apr2024         |      113.00|       37.00|
 ----------------------------------------------------------

&lt;/PRE&gt;
&lt;P&gt;But I'm curious about other options.&amp;nbsp; It almost feels like I could do this with a MULTILABEL format and a CLASSDATA dataset, but in the end I don't think that will work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will be using ODS for the output (probably ODS POWERPOINT).&amp;nbsp; So I guess I could try setting a STYLE attribute like ROWHEIGHT=0 for some rows (using CLASSLEV), and see if TABULATE will let me 'hide' a row that way.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2024 21:30:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Methods-to-hide-rows-in-PROC-TABULATE/m-p/926548#M364610</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2024-04-30T21:30:35Z</dc:date>
    </item>
    <item>
      <title>Re: Methods to hide rows in PROC TABULATE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Methods-to-hide-rows-in-PROC-TABULATE/m-p/926551#M364611</link>
      <description>&lt;P&gt;My thought to use a conditional HEIGHT style on CLASSLEV failed.&amp;nbsp; Looks like you can use conditional heights, but if you ask for a height that is 0, it gets ignored rather than hiding the row.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format ;
  value hide
  '01Apr2024'd-'23Apr2024'd='0in'
  other='1in'
  ;
run ;

proc tabulate data=have;
  class date pass;
  classlev date /style={height=hide.};
  tables date*{style=&amp;lt;parent&amp;gt;},pass ;
  format date datef. ;
run ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Apr 2024 22:05:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Methods-to-hide-rows-in-PROC-TABULATE/m-p/926551#M364611</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2024-04-30T22:05:12Z</dc:date>
    </item>
    <item>
      <title>Re: Methods to hide rows in PROC TABULATE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Methods-to-hide-rows-in-PROC-TABULATE/m-p/926558#M364616</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19879"&gt;@Quentin&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1)Yes. You can use MULTILABEL option of proc format to get it,but that is too clumsy.Here is an example.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
  do date='01Apr2024'd to '30Apr2024'd ;
    do id=1 to 5 ;
      pass=ranuni(9)&amp;lt;.3 ;
      output ;
    end ;
  end ;
  format date date9. ;
run ;

proc format ;
  value datef(multilabel notsorted)
  '24Apr2024'd='24Apr2024'
  '25Apr2024'd='25Apr2024'
  '26Apr2024'd='26Apr2024'
  '27Apr2024'd='27Apr2024'
  '28Apr2024'd='28Apr2024'
  '29Apr2024'd='29Apr2024'
  '30Apr2024'd='30Apr2024'
  '01Apr2024'd-'30Apr2024'd='01Apr2024 - 30Apr2024'
  ;
run ;

proc tabulate data=have;
format date datef.;
  class date/mlf preloadfmt order=data;
  class pass ;
  tables date,pass /printmiss;
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-1714528634655.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/96077iB7C824B631E37F45/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1714528634655.png" alt="Ksharp_0-1714528634655.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) I think the most flexible way is using PROC SQL. If you like it ,I would present it .&lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2024 01:58:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Methods-to-hide-rows-in-PROC-TABULATE/m-p/926558#M364616</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-05-01T01:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: Methods to hide rows in PROC TABULATE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Methods-to-hide-rows-in-PROC-TABULATE/m-p/927001#M364837</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I thought it would be possible with MLF, but I was stuck on the idea of using CLASSDATA to select the rows to display, forgetting that you can do it with preloadfmt order=data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I like the MLF approach, and was planning to use a macro to build the format anyway.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you'd like to show your SQL approach, I'd be happy to see it.&amp;nbsp; But for my real problem I'll probably stick with TABULATE, since the real table is more complex, with different statistics calculated by TABULATE, trafficlighting, etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And sorry for not responding sooner. I somehow missed the notification when you responded.&amp;nbsp; Luckily I got the reminder email today that said "you got responses."&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 04 May 2024 11:55:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Methods-to-hide-rows-in-PROC-TABULATE/m-p/927001#M364837</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2024-05-04T11:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: Methods to hide rows in PROC TABULATE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Methods-to-hide-rows-in-PROC-TABULATE/m-p/927075#M364869</link>
      <description>&lt;P&gt;Actually I would like to use PROC SQL which is most flexible way to handle REPORT problem, and not need to list all these levels one by one&amp;nbsp; and could produce any form/style report which PROC TABULATE is unable to do.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
  do date='01Apr2024'd to '30Apr2024'd ;
    do id=1 to 5 ;
      pass=ranuni(9)&amp;lt;.3 ;
      output ;
    end ;
  end ;
  format date date9. ;
run ;

proc sql;
create table want as
select put(date,date9.) as date,pass,count(*) as count
 from have 
  where date&amp;gt;='24Apr2024'd
   group by date,pass
union all
select 'All',pass,count(*) 
 from have
  group by pass
;
quit;
proc report data=want nowd;
column date pass,count;
define date/group order=data;
define pass/across ;
define count/analysis sum 'N';
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-1714894418340.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/96185iDF0D3AECEADA0752/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1714894418340.png" alt="Ksharp_0-1714894418340.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 May 2024 07:33:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Methods-to-hide-rows-in-PROC-TABULATE/m-p/927075#M364869</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-05-05T07:33:46Z</dc:date>
    </item>
    <item>
      <title>Re: Methods to hide rows in PROC TABULATE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Methods-to-hide-rows-in-PROC-TABULATE/m-p/927100#M364874</link>
      <description>&lt;P&gt;Thanks again&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;.&amp;nbsp; I don't think I've ever used UNION without CORR.&amp;nbsp; Cool approach.&lt;/P&gt;</description>
      <pubDate>Sun, 05 May 2024 15:22:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Methods-to-hide-rows-in-PROC-TABULATE/m-p/927100#M364874</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2024-05-05T15:22:14Z</dc:date>
    </item>
  </channel>
</rss>

