<?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: Count the number of days in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Count-the-number-of-days/m-p/702792#M37773</link>
    <description>&lt;P&gt;As stated in your other thread, do not post data as attachments. Post data following &lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;these instructions&lt;/A&gt; (and not in any other form).&lt;/P&gt;</description>
    <pubDate>Tue, 01 Dec 2020 12:36:30 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-12-01T12:36:30Z</dc:date>
    <item>
      <title>Count the number of days</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Count-the-number-of-days/m-p/702791#M37772</link>
      <description>&lt;P&gt;I have this data set and I want to get the number of days with a number of deaths equal or higher to 1 by iso_code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA MYLIB_D3.NB_DECES;&lt;BR /&gt;SET MYLIB_D3.COVID_DATA;&lt;BR /&gt;BY date iso_code;&lt;BR /&gt;WHERE new_deaths&amp;gt;=1;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC FREQ data= mylib_d3.nb_deces ;&lt;BR /&gt;TABLE date*pays;&lt;BR /&gt;RUN;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 12:34:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Count-the-number-of-days/m-p/702791#M37772</guid>
      <dc:creator>Feksan</dc:creator>
      <dc:date>2020-12-01T12:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: Count the number of days</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Count-the-number-of-days/m-p/702792#M37773</link>
      <description>&lt;P&gt;As stated in your other thread, do not post data as attachments. Post data following &lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;these instructions&lt;/A&gt; (and not in any other form).&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 12:36:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Count-the-number-of-days/m-p/702792#M37773</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-12-01T12:36:30Z</dc:date>
    </item>
    <item>
      <title>Re: Count the number of days</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Count-the-number-of-days/m-p/702804#M37778</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table MYLIB_D3.NB_DECES as
select date, iso_code, count(*) as NbyDate FROM MYLIB_D3.COVID_DATA WHERE new_deaths&amp;gt;=1 GROUP BY date, iso_code;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 01 Dec 2020 13:54:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Count-the-number-of-days/m-p/702804#M37778</guid>
      <dc:creator>utrocketeng</dc:creator>
      <dc:date>2020-12-01T13:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: Count the number of days</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Count-the-number-of-days/m-p/702806#M37779</link>
      <description>&lt;P&gt;i should say, this will give you a count of how many per day where new&amp;gt;1.&amp;nbsp; from that, you can get a count of the number of those days there are.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 13:55:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Count-the-number-of-days/m-p/702806#M37779</guid>
      <dc:creator>utrocketeng</dc:creator>
      <dc:date>2020-12-01T13:55:38Z</dc:date>
    </item>
    <item>
      <title>Re: Count the number of days</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Count-the-number-of-days/m-p/702850#M37783</link>
      <description>&lt;P&gt;I won't bother with the data you posted as an attachment, but this is a good situation for running a proc freq on a subset of the original data, and then running a proc freq and the results of the first proc freq:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=myhlib_d3.nb_deces noprint;
  where new_deaths&amp;gt;=1;
  table date*iso_code / out=need (keep=iso_code date);
run;
proc freq data=need;
  tables iso_code /out=want (keep=iso_code count);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that the WHERE filter can be applied in the first proc freq, so you don't need to run a preparatory DATA step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The first proc freq writes an output dataset NEED.&amp;nbsp; It would ordinarily have 4 variables: iso_code date count and percent.&amp;nbsp; But you only need the iso_code and date variables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then the second proc freq is applied to dataset need, giving a frequency of each iso_code, i.e. then number of unique date values encountered per iso_code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is a good example of using the power of various proc's instead of data step programming.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 17:47:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Count-the-number-of-days/m-p/702850#M37783</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-12-01T17:47:50Z</dc:date>
    </item>
  </channel>
</rss>

