<?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: How do I count the number of surveys by month for any given year? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-count-the-number-of-surveys-by-month-for-any-given-year/m-p/772017#M245073</link>
    <description>&lt;P&gt;Hello.&amp;nbsp; Below is my code for the table (I did add in your DTMONYY5 statement).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc freq data=grace;&lt;BR /&gt;table survey_timestamp /missing out=summary_month;&lt;BR /&gt;format survey_timestamp DTMONYY5;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I formatted it after the code you initially sent:&lt;/P&gt;&lt;P&gt;proc freq data=have;&lt;BR /&gt;table survey_complete /missing out=summary_month;&lt;BR /&gt;format survey_complete yymmn6.;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am still getting the dates separately, not combined/counted.&lt;/P&gt;</description>
    <pubDate>Mon, 04 Oct 2021 21:15:28 GMT</pubDate>
    <dc:creator>crankydogg</dc:creator>
    <dc:date>2021-10-04T21:15:28Z</dc:date>
    <item>
      <title>How do I count the number of surveys by month for any given year?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-count-the-number-of-surveys-by-month-for-any-given-year/m-p/771993#M245057</link>
      <description>&lt;P&gt;I am trying to figure out how many surveys have been completed each month so far this year.&amp;nbsp; I used the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;count=intck('survey_complete','01apr2021'd, '01may2021'd)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And received the following error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am also unsure if this is a stand alone statement, a data step, or something else entirely.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Oct 2021 19:00:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-count-the-number-of-surveys-by-month-for-any-given-year/m-p/771993#M245057</guid>
      <dc:creator>crankydogg</dc:creator>
      <dc:date>2021-10-04T19:00:40Z</dc:date>
    </item>
    <item>
      <title>Re: How do I count the number of surveys by month for any given year?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-count-the-number-of-surveys-by-month-for-any-given-year/m-p/771995#M245058</link>
      <description>&lt;P&gt;Your statement using INTCK can only be valid inside a data step, and must end with a semi-colon. The first argument must be a calendar interval like 'month' or 'year', it can't be 'survey_complete' which is not recognized.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please show some sample data and explain what you are trying to do in more detail.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Oct 2021 19:04:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-count-the-number-of-surveys-by-month-for-any-given-year/m-p/771995#M245058</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-10-04T19:04:57Z</dc:date>
    </item>
    <item>
      <title>Re: How do I count the number of surveys by month for any given year?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-count-the-number-of-surveys-by-month-for-any-given-year/m-p/771998#M245059</link>
      <description>If I understand your problem correctly, you should be using PROC FREQ most likely. Assuming you have a variable named 'survey_complete', which is a variable that has the date the survey was completed in a data set called 'have' your code would look like the following. Note the usage of a format on the date so that the data is aggregated at the monthly level rather than the daily level. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;proc freq data=have;&lt;BR /&gt;table survey_complete /missing out=summary_month;&lt;BR /&gt;format survey_complete yymmn6.;&lt;BR /&gt;run;&lt;BR /&gt;</description>
      <pubDate>Mon, 04 Oct 2021 19:21:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-count-the-number-of-surveys-by-month-for-any-given-year/m-p/771998#M245059</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-10-04T19:21:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do I count the number of surveys by month for any given year?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-count-the-number-of-surveys-by-month-for-any-given-year/m-p/772001#M245061</link>
      <description>&lt;P&gt;Thank you for the information.&amp;nbsp; I just realized that the survey_complete variable also has a time stamp so the information is shown as:&lt;/P&gt;&lt;P&gt;9/14/2021 2:21:00 PM&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My ultimate goal is to be able to have the data to create a table like the following:&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Month&lt;/TD&gt;&lt;TD&gt;Surveys Completed&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;January&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;February&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;March&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Oct 2021 19:45:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-count-the-number-of-surveys-by-month-for-any-given-year/m-p/772001#M245061</guid>
      <dc:creator>crankydogg</dc:creator>
      <dc:date>2021-10-04T19:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do I count the number of surveys by month for any given year?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-count-the-number-of-surveys-by-month-for-any-given-year/m-p/772002#M245062</link>
      <description>That means you have a datetime variable, not a date variable. &lt;BR /&gt;&lt;BR /&gt;Change the format in my code to :&lt;BR /&gt;&lt;BR /&gt;DTMONYY5 then to show the dates as Mar2018. &lt;BR /&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/leforinforref/p0b84w2ylz4givn13sgq4umehexc.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/leforinforref/p0b84w2ylz4givn13sgq4umehexc.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;If you would like a different format, in a prior step convert the datetime variable to a date variable using the DATEPART() function THEN reapply my original solution.</description>
      <pubDate>Mon, 04 Oct 2021 20:12:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-count-the-number-of-surveys-by-month-for-any-given-year/m-p/772002#M245062</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-10-04T20:12:32Z</dc:date>
    </item>
    <item>
      <title>Re: How do I count the number of surveys by month for any given year?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-count-the-number-of-surveys-by-month-for-any-given-year/m-p/772004#M245064</link>
      <description>&lt;P&gt;This really helped, thanks!&amp;nbsp; The table prints just fine, but the months are not merging.&amp;nbsp; Please see example below.&amp;nbsp; Any suggestions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc freq data=grace;&lt;BR /&gt;table survey_timestamp /missing out=summary_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&lt;/TD&gt;&lt;TD&gt;2.38&lt;/TD&gt;&lt;TD&gt;35&lt;/TD&gt;&lt;TD&gt;83.33&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9/13/2021&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2.38&lt;/TD&gt;&lt;TD&gt;36&lt;/TD&gt;&lt;TD&gt;85.71&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9/14/2021&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2.38&lt;/TD&gt;&lt;TD&gt;37&lt;/TD&gt;&lt;TD&gt;88.1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9/15/2021&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2.38&lt;/TD&gt;&lt;TD&gt;38&lt;/TD&gt;&lt;TD&gt;90.48&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9/2/2021&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2.38&lt;/TD&gt;&lt;TD&gt;39&lt;/TD&gt;&lt;TD&gt;92.86&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9/8/2021&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2.38&lt;/TD&gt;&lt;TD&gt;40&lt;/TD&gt;&lt;TD&gt;95.24&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;[not completed]&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;4.76&lt;/TD&gt;&lt;TD&gt;42&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Mon, 04 Oct 2021 20:27:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-count-the-number-of-surveys-by-month-for-any-given-year/m-p/772004#M245064</guid>
      <dc:creator>crankydogg</dc:creator>
      <dc:date>2021-10-04T20:27:05Z</dc:date>
    </item>
    <item>
      <title>Re: How do I count the number of surveys by month for any given year?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-count-the-number-of-surveys-by-month-for-any-given-year/m-p/772006#M245066</link>
      <description>Look at my code and yours, specifically, where did you put the format.</description>
      <pubDate>Mon, 04 Oct 2021 20:37:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-count-the-number-of-surveys-by-month-for-any-given-year/m-p/772006#M245066</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-10-04T20:37:16Z</dc:date>
    </item>
    <item>
      <title>Re: How do I count the number of surveys by month for any given year?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-count-the-number-of-surveys-by-month-for-any-given-year/m-p/772017#M245073</link>
      <description>&lt;P&gt;Hello.&amp;nbsp; Below is my code for the table (I did add in your DTMONYY5 statement).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc freq data=grace;&lt;BR /&gt;table survey_timestamp /missing out=summary_month;&lt;BR /&gt;format survey_timestamp DTMONYY5;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I formatted it after the code you initially sent:&lt;/P&gt;&lt;P&gt;proc freq data=have;&lt;BR /&gt;table survey_complete /missing out=summary_month;&lt;BR /&gt;format survey_complete yymmn6.;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am still getting the dates separately, not combined/counted.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Oct 2021 21:15:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-count-the-number-of-surveys-by-month-for-any-given-year/m-p/772017#M245073</guid>
      <dc:creator>crankydogg</dc:creator>
      <dc:date>2021-10-04T21:15:28Z</dc:date>
    </item>
    <item>
      <title>Re: How do I count the number of surveys by month for any given year?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-count-the-number-of-surveys-by-month-for-any-given-year/m-p/772023#M245077</link>
      <description>&lt;P&gt;At this point, you need to show us some sample data. Plaese follow &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;. Do not attach files or provide screen captures.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Oct 2021 21:26:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-count-the-number-of-surveys-by-month-for-any-given-year/m-p/772023#M245077</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-10-04T21:26:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I count the number of surveys by month for any given year?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-count-the-number-of-surveys-by-month-for-any-given-year/m-p/772034#M245083</link>
      <description>The YYMMN6 format WILL NOT work on a datetime variable. &lt;BR /&gt;&lt;BR /&gt;The DTMONYY5 format WILL work on a datetime variable. &lt;BR /&gt;&lt;BR /&gt;Did you use a datetime variable or  date variable? Is your variable a SAS date/datetime, ie numeric with a format attached? If its a character value that may explain what you're seeing to some degree but then you should have a note or error in the log. &lt;BR /&gt;&lt;BR /&gt;Here's an example of how this works, converting months to years in this case:&lt;BR /&gt;&lt;A href="https://gist.github.com/statgeek/0cae5568752959b035516d6ac07a20fb" target="_blank"&gt;https://gist.github.com/statgeek/0cae5568752959b035516d6ac07a20fb&lt;/A&gt;</description>
      <pubDate>Mon, 04 Oct 2021 22:12:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-count-the-number-of-surveys-by-month-for-any-given-year/m-p/772034#M245083</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-10-04T22:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: How do I count the number of surveys by month for any given year?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-count-the-number-of-surveys-by-month-for-any-given-year/m-p/772150#M245147</link>
      <description>&lt;P&gt;Thank you again for responding.&amp;nbsp; I did use the&amp;nbsp;&lt;SPAN&gt;DTMONYY5 format and it ran without an error.&amp;nbsp; I appreciate your help.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;On a separate note regarding the date/time, I later converted this variable to a character variable in the format of "Month ID" and was able to summarize the data based on this month-id level.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 13:21:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-count-the-number-of-surveys-by-month-for-any-given-year/m-p/772150#M245147</guid>
      <dc:creator>crankydogg</dc:creator>
      <dc:date>2021-10-05T13:21:25Z</dc:date>
    </item>
    <item>
      <title>Re: How do I count the number of surveys by month for any given year?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-count-the-number-of-surveys-by-month-for-any-given-year/m-p/772206#M245172</link>
      <description>If your month are now character values, then the months won't sort in order if they have values like Jan2021, Feb2021 they sort alphabetically instead. &lt;BR /&gt;</description>
      <pubDate>Tue, 05 Oct 2021 15:29:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-count-the-number-of-surveys-by-month-for-any-given-year/m-p/772206#M245172</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-10-05T15:29:07Z</dc:date>
    </item>
  </channel>
</rss>

