<?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 Freq or Proc SQL in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-or-Proc-SQL/m-p/304779#M64893</link>
    <description>I'm not sure I follow that code..</description>
    <pubDate>Fri, 14 Oct 2016 19:42:07 GMT</pubDate>
    <dc:creator>trt3s</dc:creator>
    <dc:date>2016-10-14T19:42:07Z</dc:date>
    <item>
      <title>Proc Freq or Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-or-Proc-SQL/m-p/304775#M64890</link>
      <description>&lt;P&gt;New SAS Programmer, and I am currently using Proc Freq to calculate the percent and count of two variables in a dataset and it works great. However, I need to only display the events where there percent is greater than 15. I am assuming I should use a proc sql so that I can create a table and then use that created dataset to write if 'variable' lt .15 delete or something to that nature. However, I am not very familar with proc sql or prox freq for that matter, and maybe there is a way to do this in proc freq but I am not sure how. I would 'prefer' to use PROC Freq over Proc SQL because I understand it better, but that is just my preference. My current syntax reads;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc freq data=table2;&lt;BR /&gt;table SOC&amp;nbsp;CODE / nocum;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;any ideas?&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 19:34:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-or-Proc-SQL/m-p/304775#M64890</guid>
      <dc:creator>trt3s</dc:creator>
      <dc:date>2016-10-14T19:34:30Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq or Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-or-Proc-SQL/m-p/304777#M64892</link>
      <description>&lt;P&gt;Either way you're going to go through the same process - create a table with results and then filter and print it out. I think it's a bit simpler in proc freq since you already have the calculations completed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have some code here that processes a proc freq table and generates the output in a formatted form, you can add a WHERE clause to the last table to filter your results.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://gist.github.com/statgeek/e0903d269d4a71316a4e" target="_blank"&gt;https://gist.github.com/statgeek/e0903d269d4a71316a4e&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 19:38:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-or-Proc-SQL/m-p/304777#M64892</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-10-14T19:38:25Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq or Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-or-Proc-SQL/m-p/304779#M64893</link>
      <description>I'm not sure I follow that code..</description>
      <pubDate>Fri, 14 Oct 2016 19:42:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-or-Proc-SQL/m-p/304779#M64893</guid>
      <dc:creator>trt3s</dc:creator>
      <dc:date>2016-10-14T19:42:07Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq or Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-or-Proc-SQL/m-p/304782#M64894</link>
      <description>&lt;P&gt;Here's a simplified version of what should happen. &amp;nbsp;It assumes that the percents should be based on the total count of all observations, not on the subset of those with a percent &amp;gt; 15%.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc freq data=have;&lt;/P&gt;
&lt;P&gt;tables soc / noprint out=soc_stats;&lt;/P&gt;
&lt;P&gt;tables code / noprint out=code_stats;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc print data=soc_stats;&lt;/P&gt;
&lt;P&gt;where percent &amp;gt; 15;&lt;/P&gt;
&lt;P&gt;var soc count percent;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;***Looks like I was 34 seconds slower than ballardw.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc print data=code_stats;&lt;/P&gt;
&lt;P&gt;where percent &amp;gt; 15;&lt;/P&gt;
&lt;P&gt;var code count percent;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may have to double-check on the right cutoff for the WHERE statement. &amp;nbsp;I believe that 15 is correct, but you may need to change it to 0.15 instead.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 19:53:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-or-Proc-SQL/m-p/304782#M64894</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-10-14T19:53:39Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq or Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-or-Proc-SQL/m-p/304783#M64895</link>
      <description>&lt;P&gt;Maybe simpler though less complete:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=table2 noprint;
   tables SOC  / nocum out=SOCFreq;     /*&amp;lt;= creates output summary set*/
   tables CODE / nocum out=CodeFreq;
run;

proc print data= SOCFreq noobs;
   where percent ge 15;    /*&amp;lt;= Filter on percent*/
run;

proc print data= CodeFreq noobs;
   where percent ge 15;    /*&amp;lt;= Filter on percent*/
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note the Freq only creates an output data set for one-way table this way for the last variable on each tables statement, so there are two tables, one to create each output data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 19:52:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-or-Proc-SQL/m-p/304783#M64895</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-10-14T19:52:40Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq or Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-or-Proc-SQL/m-p/304784#M64896</link>
      <description>Thank you! both work!</description>
      <pubDate>Fri, 14 Oct 2016 19:55:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-or-Proc-SQL/m-p/304784#M64896</guid>
      <dc:creator>trt3s</dc:creator>
      <dc:date>2016-10-14T19:55:30Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq or Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-or-Proc-SQL/m-p/304785#M64897</link>
      <description>I am sure this works great as well, but I am not yet able to follow that code. Thank you though!</description>
      <pubDate>Fri, 14 Oct 2016 19:56:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-or-Proc-SQL/m-p/304785#M64897</guid>
      <dc:creator>trt3s</dc:creator>
      <dc:date>2016-10-14T19:56:16Z</dc:date>
    </item>
  </channel>
</rss>

