<?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: option autofilter in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/option-autofilter/m-p/896066#M354037</link>
    <description>&lt;PRE class=""&gt;&lt;SPAN class=""&gt;THANKS,
I had already output this result, but it's not what I'm looking for.&lt;/SPAN&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 27 Sep 2023 14:54:38 GMT</pubDate>
    <dc:creator>snip</dc:creator>
    <dc:date>2023-09-27T14:54:38Z</dc:date>
    <item>
      <title>option autofilter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/option-autofilter/m-p/895643#M353865</link>
      <description>&lt;PRE class=""&gt;&lt;SPAN class=""&gt;Good morning,
I'm trying to use a proc tabulate on my table.
the autofilter option is not working properly on my group by and I don't know why.
I group by col1 col2 col3 col4 in my table, I have the autofilter which is set up in my Excel output, but if I filter for example my column COL1 on its first value to analyze my results, it shows me that only one line everywhere, yet this first line in col1 corresponds to several lines in col2 col3... since it is a group by
Could you help me ?&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;options( autofilter = "1-4" frozen_headers = "on" frozen_rowheaders = "4" /*start_at='A2'*/ sheet_interval='none' sheet_name='C5');

PROC TABULATE data=STATS;
class COL1 COL2 COL3 COL4  /ORDER=DATA;
classlev  COL1 COL2 COL3 COL4  ;
VAR  COL5 COL6;
TABLE   COL1*COL2*COL3*COL4,COL5 COL6 
;RUN;

ods excel close;&lt;/PRE&gt;&lt;PRE class=""&gt;&amp;nbsp;&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Sep 2023 10:51:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/option-autofilter/m-p/895643#M353865</guid>
      <dc:creator>snip</dc:creator>
      <dc:date>2023-09-25T10:51:00Z</dc:date>
    </item>
    <item>
      <title>Re: option autofilter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/option-autofilter/m-p/895652#M353870</link>
      <description>&lt;P&gt;When I run this code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods excel file="test.xlsx"
			options( autofilter = "1-2" 
						frozen_headers = "on" 
						frozen_rowheaders = "2" 
						sheet_interval='none' 
						sheet_name='C5');

PROC TABULATE data=sashelp.cars;
class ORIGIN MAKE /ORDER=DATA;
classlev  ORIGIN MAKE;
VAR  MPG_CITY MPG_HIGHWAY;
TABLE   ORIGIN*MAKE,MPG_CITY MPG_HIGHWAY;
RUN;

ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The resulting Excel file has autofilters set for the specified columns:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SASJedi_0-1695643609861.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/88257iEAF1368A5F4EAA9C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SASJedi_0-1695643609861.png" alt="SASJedi_0-1695643609861.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Where I select only Asia for the first column filter in Excel, only one row shows&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SASJedi_1-1695643838242.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/88258i787BCEDC4EDA65EC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SASJedi_1-1695643838242.png" alt="SASJedi_1-1695643838242.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is because, in the report, only one row contains the value "Asia" in the first column. The rows underneath do not contain any values, so they are filtered out by Excel.&amp;nbsp;This is the way Excel filters work.&amp;nbsp; What were you expecting / how do you want it to work?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2023 12:13:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/option-autofilter/m-p/895652#M353870</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2023-09-25T12:13:07Z</dc:date>
    </item>
    <item>
      <title>Re: option autofilter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/option-autofilter/m-p/895657#M353872</link>
      <description>&lt;PRE class=""&gt;&lt;SPAN class=""&gt;Thank you for your reply.
I want if I filter a group, the whole group must be displayed.
if I filter Asia I must have in front:
Acura
Honda
Hyundai
Infiniti
Isuzu
Kia
Lexus
Mazda
Mitsubishi
Nissan
Scion
Subaru
Suzuki
Toyota&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="snip_0-1695646407774.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/88260i707E1FFD54BA3904/image-size/medium?v=v2&amp;amp;px=400" role="button" title="snip_0-1695646407774.png" alt="snip_0-1695646407774.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class=""&gt;&amp;nbsp;&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Sep 2023 12:53:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/option-autofilter/m-p/895657#M353872</guid>
      <dc:creator>snip</dc:creator>
      <dc:date>2023-09-25T12:53:56Z</dc:date>
    </item>
    <item>
      <title>Re: option autofilter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/option-autofilter/m-p/895963#M353993</link>
      <description>&lt;P&gt;In an Excel spreadsheet, if you want to select "Asia" as the auto-filter value for the first column and see ALL of the rows associated with Asia, then&amp;nbsp;&lt;EM&gt;every row&lt;/EM&gt;&amp;nbsp;associated with Asia must have the word 'Asia' in the cell, like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SASJedi_0-1695760843221.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/88361iAC3C76D176033288/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SASJedi_0-1695760843221.png" alt="SASJedi_0-1695760843221.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;This behavior is a function of how Excel filters data and is nothing you can control from a SAS program. As far as I know, PROC TABULATE&amp;nbsp; doesn't make output like that, but others more familiar with the PROC might have input.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'd approach this using PROC SQL instead because it can produce the result shown above:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods excel file="test.xlsx"
			options( autofilter = "1-2" 
						frozen_headers = "on" 
						frozen_rowheaders = "2" 
						sheet_interval='none' 
						sheet_name='C5-sql');
proc sql;
select Origin
		,Make
		,SUM(MPG_CITY) 'MPG (City) Sum'
		,SUM(MPG_HIGHWAY) 'MPG (Highway) Sum'
	from sashelp.cars
	group by Origin, Make
	order by Origin, Make
;
quit;

ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;All the best,&lt;BR /&gt;Mark&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2023 20:51:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/option-autofilter/m-p/895963#M353993</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2023-09-26T20:51:10Z</dc:date>
    </item>
    <item>
      <title>Re: option autofilter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/option-autofilter/m-p/896066#M354037</link>
      <description>&lt;PRE class=""&gt;&lt;SPAN class=""&gt;THANKS,
I had already output this result, but it's not what I'm looking for.&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Sep 2023 14:54:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/option-autofilter/m-p/896066#M354037</guid>
      <dc:creator>snip</dc:creator>
      <dc:date>2023-09-27T14:54:38Z</dc:date>
    </item>
  </channel>
</rss>

