<?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: Frequency Using Proc Sql in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Frequency-Using-Proc-Sql/m-p/404083#M98228</link>
    <description>&lt;P&gt;Change it to PROC FREQ.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Change it to count everything, not just Gender.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the future post your code in a legible format, the post above requires edits which is a pain.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;select Gender,count(Gender) as frequencyfrom havegroup by Gender;quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="delete_sql_count.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/15882i8C37ACA78140BFCA/image-size/large?v=v2&amp;amp;px=999" role="button" title="delete_sql_count.JPG" alt="delete_sql_count.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 13 Oct 2017 19:28:05 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-10-13T19:28:05Z</dc:date>
    <item>
      <title>Frequency Using Proc Sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Frequency-Using-Proc-Sql/m-p/404053#M98218</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to do a frequency on a variable using proc sql.&lt;/P&gt;
&lt;P&gt;I am doint count(VariableName) and also group by (VariableName) but it does not count the records where there is no value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am looking for something equivalent to the missing option in proc freq.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is my code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id Gender $;
datalines;
1 M
2 F
3 M
4 .
5 .
6 F
;
run;
proc sql;&lt;BR /&gt;select &lt;BR /&gt;Gender&lt;BR /&gt;,count(Gender) as frequency&lt;BR /&gt;from have&lt;BR /&gt;group by Gender&lt;BR /&gt;;quit;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The output is:&lt;/P&gt;
&lt;P&gt;Gender&amp;nbsp; Frequency&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;F&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;
&lt;P&gt;M&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;I want the output to be like:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Gender Frequency&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;F&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;
&lt;P&gt;M&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 17:56:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Frequency-Using-Proc-Sql/m-p/404053#M98218</guid>
      <dc:creator>ArpitSharma</dc:creator>
      <dc:date>2017-10-13T17:56:43Z</dc:date>
    </item>
    <item>
      <title>Re: Frequency Using Proc Sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Frequency-Using-Proc-Sql/m-p/404058#M98220</link>
      <description>&lt;P&gt;I was able to get this done but &lt;STRONG&gt;I am sure there is a better way to do it: Please suggest&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table freq as
select 
Gender
,sum(freq1,freq2) as frequency
from (	select 
		Gender
		,nmiss(gender) as freq1
		,count(Gender) as freq2
		from have
		group by Gender
		)
;quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Oct 2017 18:09:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Frequency-Using-Proc-Sql/m-p/404058#M98220</guid>
      <dc:creator>ArpitSharma</dc:creator>
      <dc:date>2017-10-13T18:09:56Z</dc:date>
    </item>
    <item>
      <title>Re: Frequency Using Proc Sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Frequency-Using-Proc-Sql/m-p/404062#M98222</link>
      <description>&lt;P&gt;Better way: use PROC FREQ&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 18:14:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Frequency-Using-Proc-Sql/m-p/404062#M98222</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-10-13T18:14:55Z</dc:date>
    </item>
    <item>
      <title>Re: Frequency Using Proc Sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Frequency-Using-Proc-Sql/m-p/404065#M98223</link>
      <description>&lt;P&gt;There is a valid reason to not use PROC FREQ -- maybe -- and that's if your data is in a database and you want the SQL work to push down to the database instead of bringing the data records into SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, that's not as true as it once was.&amp;nbsp; PROC FREQ&amp;nbsp;&lt;STRONG&gt;can&lt;/STRONG&gt; push work down to the database in SAS 9.3 and later, as long as you're using a SAS/ACCESS library engine to get to it.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 18:23:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Frequency-Using-Proc-Sql/m-p/404065#M98223</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2017-10-13T18:23:02Z</dc:date>
    </item>
    <item>
      <title>Re: Frequency Using Proc Sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Frequency-Using-Proc-Sql/m-p/404083#M98228</link>
      <description>&lt;P&gt;Change it to PROC FREQ.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Change it to count everything, not just Gender.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the future post your code in a legible format, the post above requires edits which is a pain.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;select Gender,count(Gender) as frequencyfrom havegroup by Gender;quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="delete_sql_count.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/15882i8C37ACA78140BFCA/image-size/large?v=v2&amp;amp;px=999" role="button" title="delete_sql_count.JPG" alt="delete_sql_count.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 19:28:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Frequency-Using-Proc-Sql/m-p/404083#M98228</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-10-13T19:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: Frequency Using Proc Sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Frequency-Using-Proc-Sql/m-p/404191#M98245</link>
      <description>&lt;P&gt;The easy way is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select 
    Gender,
    count(*) as frequency
from have
group by Gender;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 14 Oct 2017 04:15:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Frequency-Using-Proc-Sql/m-p/404191#M98245</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-10-14T04:15:25Z</dc:date>
    </item>
    <item>
      <title>Re: Frequency Using Proc Sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Frequency-Using-Proc-Sql/m-p/404214#M98254</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=have;
table gender/ missing;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 14 Oct 2017 12:33:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Frequency-Using-Proc-Sql/m-p/404214#M98254</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-10-14T12:33:20Z</dc:date>
    </item>
  </channel>
</rss>

