<?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: Suppressing entire rows with proc tabulate when n &amp;lt;=5 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Suppressing-entire-rows-with-proc-tabulate-when-n-lt-5/m-p/924407#M363866</link>
    <description>&lt;P&gt;Presummarize your data and use that set for the output. Then you can filter on values in the data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc Tabulate won't know "n", or any other statistic, until the output is created.&lt;/P&gt;
&lt;P&gt;Consider that proc tabulate can have multiple "n" statistics in any given row (multiple variables in the column dimension). Any "n&amp;lt;=5" would require some convoluted way to deal with each possible different column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: you may want to be a bit more careful in your example data. You only provided 5 example rows and want to suppress "n&amp;lt;=5". So all of your data is suppressed. Nothing to show.&lt;/P&gt;
&lt;P&gt;And what exactly would "suppress" mean? Not show the row header? Show the row header but Missing for all values?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This may give you an example for summarizing the data. However more complex data /summaries likely require more examples of what is needed.&lt;/P&gt;
&lt;PRE&gt;data mydata;
input id $ score1 score2;
datalines;
alfred 9 10
alice 13 12
barbara 10 8
carol . 5
joe . 9
;

proc means data=mydata STACKODSOUTPUT n nmiss min max;
   var score1 score2;
   ods output summary=stacked;
run;
&lt;/PRE&gt;
&lt;P&gt;Depending on exactly what you expect to display in the final output the data set Stacked may need additional manipulation in a data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 15 Apr 2024 17:46:10 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2024-04-15T17:46:10Z</dc:date>
    <item>
      <title>Suppressing entire rows with proc tabulate when n &lt;=5</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Suppressing-entire-rows-with-proc-tabulate-when-n-lt-5/m-p/924404#M363863</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to show a summary&amp;nbsp; (n, nmiss, min, and max) of variables in my data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But, I want to suppress a row(s) if n &amp;lt;=5.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a sample data and proc tabulate to get n, nmiss, min, and max.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to suppress data of score 1 because&amp;nbsp; its n =3.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;data mydata;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; input id score1 score2;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; datalines;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;alfred 9 10&lt;/DIV&gt;
&lt;DIV&gt;alice 13 12&lt;/DIV&gt;
&lt;DIV&gt;barbara 10 8&lt;/DIV&gt;
&lt;DIV&gt;carol . 5&lt;/DIV&gt;
&lt;DIV&gt;joe . 9&lt;/DIV&gt;
&lt;DIV&gt;;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;proc tabulate data=mydata;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; var score1 score2;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; table score1 score2, n nmiss min max;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;run;&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please let me know if you know how to suppress the entire row (n, nmiss, min, max).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yoko&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 17:32:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Suppressing-entire-rows-with-proc-tabulate-when-n-lt-5/m-p/924404#M363863</guid>
      <dc:creator>Yoko</dc:creator>
      <dc:date>2024-04-15T17:32:03Z</dc:date>
    </item>
    <item>
      <title>Re: Suppressing entire rows with proc tabulate when n &lt;=5</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Suppressing-entire-rows-with-proc-tabulate-when-n-lt-5/m-p/924407#M363866</link>
      <description>&lt;P&gt;Presummarize your data and use that set for the output. Then you can filter on values in the data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc Tabulate won't know "n", or any other statistic, until the output is created.&lt;/P&gt;
&lt;P&gt;Consider that proc tabulate can have multiple "n" statistics in any given row (multiple variables in the column dimension). Any "n&amp;lt;=5" would require some convoluted way to deal with each possible different column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: you may want to be a bit more careful in your example data. You only provided 5 example rows and want to suppress "n&amp;lt;=5". So all of your data is suppressed. Nothing to show.&lt;/P&gt;
&lt;P&gt;And what exactly would "suppress" mean? Not show the row header? Show the row header but Missing for all values?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This may give you an example for summarizing the data. However more complex data /summaries likely require more examples of what is needed.&lt;/P&gt;
&lt;PRE&gt;data mydata;
input id $ score1 score2;
datalines;
alfred 9 10
alice 13 12
barbara 10 8
carol . 5
joe . 9
;

proc means data=mydata STACKODSOUTPUT n nmiss min max;
   var score1 score2;
   ods output summary=stacked;
run;
&lt;/PRE&gt;
&lt;P&gt;Depending on exactly what you expect to display in the final output the data set Stacked may need additional manipulation in a data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 17:46:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Suppressing-entire-rows-with-proc-tabulate-when-n-lt-5/m-p/924407#M363866</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-04-15T17:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: Suppressing entire rows with proc tabulate when n &lt;=5</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Suppressing-entire-rows-with-proc-tabulate-when-n-lt-5/m-p/924440#M363881</link>
      <description>&lt;P&gt;This program runs proc tabulate only of variables with minimum values greater than 5.&amp;nbsp; &amp;nbsp;If there are no such variables, no proc tabulate will be invoked.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data mydata;
input score1 score2 ;
datalines;
10 110
11 111
2 112
13 113
14 114
15 115
run;

data _null_;
  set mydata end=end_of_data;
  array s     {*}     score1 score2 ;
  array names {2} $32 _temporary_ ("SCORE1","SCORE2");

  do v=1 to dim(s);
    if names{v}^=' ' then do;
      if 0&amp;lt;=s{v}&amp;lt;=5 then names{v}=' ';
    end;
  end;
  if countw(catx(' ',of names{*}))=0 then do;
    put '*** Every VAR has at least one value &amp;lt; 5. ***';
    put '*** No PROC TABULATE will be done.        ***';
    stop;
  end;
  if end_of_data;
  call execute('proc tabulate data=mydata;');
  call execute(catx(' ','var',of names{*},';'));
  call execute(catx(' ','table',of names{*},', n nmiss min max',';'));
  call execute('run;');
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;When a variable has a value &amp;lt;=5 its name is removed from the NAMES array.&amp;nbsp; That array of names is what gets submitted to the proc tabulate.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The "call execute" statement queues up SAS code to be run immediately after the current DATA step.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2024 01:17:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Suppressing-entire-rows-with-proc-tabulate-when-n-lt-5/m-p/924440#M363881</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2024-04-16T01:17:34Z</dc:date>
    </item>
    <item>
      <title>Re: Suppressing entire rows with proc tabulate when n &lt;=5</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Suppressing-entire-rows-with-proc-tabulate-when-n-lt-5/m-p/924460#M363886</link>
      <description>&lt;P&gt;If this is a recurring requirement, you might want to look into T-argus (developed by (for?) Eurostat) and SAS macro package to communicate with T-argus (SAS2argus).&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/sdcTools/SAS2Argus" target="_blank"&gt;https://github.com/sdcTools/SAS2Argus&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://research.cbs.nl/casc/tau.htm" target="_blank"&gt;τ-ARGUS (cbs.nl)&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2024 09:05:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Suppressing-entire-rows-with-proc-tabulate-when-n-lt-5/m-p/924460#M363886</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2024-04-16T09:05:17Z</dc:date>
    </item>
  </channel>
</rss>

