<?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 sql create table to count records split into three criteria in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-create-table-to-count-records-split-into-three-criteria/m-p/555573#M154623</link>
    <description>&lt;P&gt;Ok. Please see if the below code works for you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 02 May 2019 11:28:51 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2019-05-02T11:28:51Z</dc:date>
    <item>
      <title>proc sql create table to count records split into three criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-create-table-to-count-records-split-into-three-criteria/m-p/555557#M154615</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a variable, utilisation, which has a range of values. I have the following SAS code below to start but is there a line(s) that someone could help me with in order to create a table which counts the number of records where the variable utilisation=0, utilisation&amp;lt;0.65 and utilisation&amp;gt;0.65, so the output data looks like the table below and have the same headings? Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;sql&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;create table utilisation as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; utilisation,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; count(*)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from rc.accounts&lt;/P&gt;&lt;P&gt;&amp;nbsp;group by &lt;STRONG&gt;1&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Utilisation.PNG" style="width: 155px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29156iE459CD3010698180/image-size/small?v=v2&amp;amp;px=200" role="button" title="Utilisation.PNG" alt="Utilisation.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2019 11:06:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-create-table-to-count-records-split-into-three-criteria/m-p/555557#M154615</guid>
      <dc:creator>jeremy4</dc:creator>
      <dc:date>2019-05-02T11:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql create table to count records split into three criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-create-table-to-count-records-split-into-three-criteria/m-p/555558#M154616</link>
      <description>&lt;P&gt;In this scenario, should the zero values also be counted as under .65 or are they mutually exclusive? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2019 11:15:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-create-table-to-count-records-split-into-three-criteria/m-p/555558#M154616</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-05-02T11:15:55Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql create table to count records split into three criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-create-table-to-count-records-split-into-three-criteria/m-p/555562#M154617</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Thanks for pointing that out - utilisation=0 should be in one band. Anything greater than 0 and less than 0.65 i.e. 0&amp;lt;utilisation&amp;lt;0.65 should be in band 2, utilisation&amp;gt;0.65 in band 3.</description>
      <pubDate>Thu, 02 May 2019 11:20:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-create-table-to-count-records-split-into-three-criteria/m-p/555562#M154617</guid>
      <dc:creator>jeremy4</dc:creator>
      <dc:date>2019-05-02T11:20:16Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql create table to count records split into three criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-create-table-to-count-records-split-into-three-criteria/m-p/555564#M154618</link>
      <description>&lt;P&gt;Ok. So what about negative values? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2019 11:22:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-create-table-to-count-records-split-into-three-criteria/m-p/555564#M154618</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-05-02T11:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql create table to count records split into three criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-create-table-to-count-records-split-into-three-criteria/m-p/555566#M154620</link>
      <description>&lt;P&gt;I wouldn't use PROC SQL for a problem like this. Use PROC FORMAT and PROC FREQ in combination like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data somedata;
   do x=1 to 1000;
      utilisation=rand('uniform');
      output;
   end;
   do x=1 to 100;
      utilisation=0;
      output;
   end;
run;

proc format library=work;
   value overunder
      0           = '0'
      0 &amp;lt;- .65    = '&amp;lt;= 0.65'
      .65 &amp;lt;- high = '&amp;gt; 0.65'
      other       = 'Unknown';
run;

proc freq data=somedata;
   tables utilisation / nocum nopercent out=want;
   format utilisation overunder.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 May 2019 11:28:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-create-table-to-count-records-split-into-three-criteria/m-p/555566#M154620</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-05-02T11:28:29Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql create table to count records split into three criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-create-table-to-count-records-split-into-three-criteria/m-p/555572#M154622</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I've done a check on the minimum values and there aren't any negative values for the 'utilisation' variable. So the table would count the number of records that fit the following three criteria:&lt;BR /&gt;&lt;BR /&gt;Band 1: Utilisation = 0&lt;BR /&gt;Band 2: 0&amp;lt;Utilisation&amp;lt;=0.65&lt;BR /&gt;Band 3: Utilisation&amp;gt;0.65</description>
      <pubDate>Thu, 02 May 2019 11:27:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-create-table-to-count-records-split-into-three-criteria/m-p/555572#M154622</guid>
      <dc:creator>jeremy4</dc:creator>
      <dc:date>2019-05-02T11:27:43Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql create table to count records split into three criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-create-table-to-count-records-split-into-three-criteria/m-p/555573#M154623</link>
      <description>&lt;P&gt;Ok. Please see if the below code works for you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2019 11:28:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-create-table-to-count-records-split-into-three-criteria/m-p/555573#M154623</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-05-02T11:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql create table to count records split into three criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-create-table-to-count-records-split-into-three-criteria/m-p/555575#M154625</link>
      <description>Hi,&lt;BR /&gt;Thanks a lot for your code - the results look good but can I double-check that for the part of your code where you write 0 &amp;lt;- .65 = '&amp;lt;= 0.65', do I need to add an = somewhere for the 0 &amp;lt;- .65 (i.e. LHS of that line), so that it matches the criteria that 0&amp;lt;Utilisation&amp;lt;=0.65?</description>
      <pubDate>Thu, 02 May 2019 11:45:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-create-table-to-count-records-split-into-three-criteria/m-p/555575#M154625</guid>
      <dc:creator>jeremy4</dc:creator>
      <dc:date>2019-05-02T11:45:44Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql create table to count records split into three criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-create-table-to-count-records-split-into-three-criteria/m-p/555577#M154626</link>
      <description>&lt;P&gt;Always good to double check. But no, no need to add an equal sign &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;0 &amp;lt;- .65&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;does &lt;STRONG&gt;not&lt;/STRONG&gt; include 0, but &lt;STRONG&gt;does&lt;/STRONG&gt; include 0.65&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;0 - .65&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;includes both values and this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;0 &amp;lt;-&amp;lt; .65&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;includes neither &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2019 11:49:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-create-table-to-count-records-split-into-three-criteria/m-p/555577#M154626</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-05-02T11:49:17Z</dc:date>
    </item>
  </channel>
</rss>

