<?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 get month/year frequency of data with timestamp format DATETIME20. ? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-month-year-frequency-of-data-with-timestamp-format/m-p/928307#M365235</link>
    <description>&lt;P&gt;Use the DTMONYY7. format for the Proc Freq.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are multiple formats to show just the date information similar to a date format for datetime values that have DT as the start of the name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/465944"&gt;@SAS_hack&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello SAS community!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a dataset where each entry has a date and timestamp in "DATETIME20." format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Examples of data entry dates (there are tens of thousands in each month, going back many years):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;16FEB2021:07:02:19&lt;BR /&gt;28MAR2023:11:52:22&lt;BR /&gt;06JAN2024:17:23.51&lt;/P&gt;
&lt;P&gt;21APR2024:23:02:38&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to run a proc freq where I get the count of the events by month and year.&amp;nbsp; Ideally the output would look something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NOV23&amp;nbsp; 37248&lt;/P&gt;
&lt;P&gt;DEC23&amp;nbsp; &amp;nbsp;41836&lt;/P&gt;
&lt;P&gt;JAN24&amp;nbsp; &amp;nbsp;39234&lt;/P&gt;
&lt;P&gt;FEB24&amp;nbsp; &amp;nbsp;52868&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or even better&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NOV2023&amp;nbsp; 37248&lt;/P&gt;
&lt;P&gt;DEC2023&amp;nbsp; &amp;nbsp;41836&lt;/P&gt;
&lt;P&gt;JAN2024&amp;nbsp; &amp;nbsp;39234&lt;/P&gt;
&lt;P&gt;FEB2024&amp;nbsp; &amp;nbsp;52868&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My code is presently:&lt;/P&gt;
&lt;P&gt;PROC FREQ DATA=FLAGSDAT;&lt;BR /&gt;TABLE ENTRY_DATE*FLAG_VALUE / NOPERCENT NOCUM NOROW NOCOL;&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The current code's output looks like this (using a dummy dataset for speed of testing where all the timestamps are at midnight):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;31DEC2023:00:00:00 ‚ 9&lt;BR /&gt;01JAN2024:00:00:00 ‚ 11&lt;BR /&gt;22JAN2024:00:00:00 ‚ 13&lt;BR /&gt;13FEB024:00:00:00 ‚ 12&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried using this code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC FREQ DATA=FLAGSDAT;&lt;BR /&gt;TABLE ENTRY_DATE*FLAG_VALUE / NOPERCENT NOCUM NOROW NOCOL;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;FORMAT ENTRY_DATE MONYY.;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But that did not work.&amp;nbsp; Any advice for a simple fix to get the dates in the PROC FREQ output to just be MONYY or MONYYYY?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For my dummy data, I would like the output to look like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DEC2023&amp;nbsp; 9&lt;/P&gt;
&lt;P&gt;JAN2024&amp;nbsp; 24&lt;/P&gt;
&lt;P&gt;FEB2024 12&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 14 May 2024 20:08:55 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2024-05-14T20:08:55Z</dc:date>
    <item>
      <title>How do I get month/year frequency of data with timestamp format DATETIME20. ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-month-year-frequency-of-data-with-timestamp-format/m-p/928306#M365234</link>
      <description>&lt;P&gt;Hello SAS community!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset where each entry has a date and timestamp in "DATETIME20." format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Examples of data entry dates (there are tens of thousands in each month, going back many years):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;16FEB2021:07:02:19&lt;BR /&gt;28MAR2023:11:52:22&lt;BR /&gt;06JAN2024:17:23.51&lt;/P&gt;&lt;P&gt;21APR2024:23:02:38&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to run a proc freq where I get the count of the events by month and year.&amp;nbsp; Ideally the output would look something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOV23&amp;nbsp; 37248&lt;/P&gt;&lt;P&gt;DEC23&amp;nbsp; &amp;nbsp;41836&lt;/P&gt;&lt;P&gt;JAN24&amp;nbsp; &amp;nbsp;39234&lt;/P&gt;&lt;P&gt;FEB24&amp;nbsp; &amp;nbsp;52868&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;or even better&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOV2023&amp;nbsp; 37248&lt;/P&gt;&lt;P&gt;DEC2023&amp;nbsp; &amp;nbsp;41836&lt;/P&gt;&lt;P&gt;JAN2024&amp;nbsp; &amp;nbsp;39234&lt;/P&gt;&lt;P&gt;FEB2024&amp;nbsp; &amp;nbsp;52868&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code is presently:&lt;/P&gt;&lt;P&gt;PROC FREQ DATA=FLAGSDAT;&lt;BR /&gt;TABLE ENTRY_DATE*FLAG_VALUE / NOPERCENT NOCUM NOROW NOCOL;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The current code's output looks like this (using a dummy dataset for speed of testing where all the timestamps are at midnight):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;31DEC2023:00:00:00 ‚ 9&lt;BR /&gt;01JAN2024:00:00:00 ‚ 11&lt;BR /&gt;22JAN2024:00:00:00 ‚ 13&lt;BR /&gt;13FEB024:00:00:00 ‚ 12&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried using this code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC FREQ DATA=FLAGSDAT;&lt;BR /&gt;TABLE ENTRY_DATE*FLAG_VALUE / NOPERCENT NOCUM NOROW NOCOL;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FORMAT ENTRY_DATE MONYY.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But that did not work.&amp;nbsp; Any advice for a simple fix to get the dates in the PROC FREQ output to just be MONYY or MONYYYY?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For my dummy data, I would like the output to look like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DEC2023&amp;nbsp; 9&lt;/P&gt;&lt;P&gt;JAN2024&amp;nbsp; 24&lt;/P&gt;&lt;P&gt;FEB2024 12&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance!&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2024 15:49:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-month-year-frequency-of-data-with-timestamp-format/m-p/928306#M365234</guid>
      <dc:creator>SAS_hack</dc:creator>
      <dc:date>2024-05-14T15:49:14Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get month/year frequency of data with timestamp format DATETIME20. ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-month-year-frequency-of-data-with-timestamp-format/m-p/928307#M365235</link>
      <description>&lt;P&gt;Use the DTMONYY7. format for the Proc Freq.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are multiple formats to show just the date information similar to a date format for datetime values that have DT as the start of the name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/465944"&gt;@SAS_hack&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello SAS community!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a dataset where each entry has a date and timestamp in "DATETIME20." format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Examples of data entry dates (there are tens of thousands in each month, going back many years):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;16FEB2021:07:02:19&lt;BR /&gt;28MAR2023:11:52:22&lt;BR /&gt;06JAN2024:17:23.51&lt;/P&gt;
&lt;P&gt;21APR2024:23:02:38&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to run a proc freq where I get the count of the events by month and year.&amp;nbsp; Ideally the output would look something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NOV23&amp;nbsp; 37248&lt;/P&gt;
&lt;P&gt;DEC23&amp;nbsp; &amp;nbsp;41836&lt;/P&gt;
&lt;P&gt;JAN24&amp;nbsp; &amp;nbsp;39234&lt;/P&gt;
&lt;P&gt;FEB24&amp;nbsp; &amp;nbsp;52868&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or even better&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NOV2023&amp;nbsp; 37248&lt;/P&gt;
&lt;P&gt;DEC2023&amp;nbsp; &amp;nbsp;41836&lt;/P&gt;
&lt;P&gt;JAN2024&amp;nbsp; &amp;nbsp;39234&lt;/P&gt;
&lt;P&gt;FEB2024&amp;nbsp; &amp;nbsp;52868&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My code is presently:&lt;/P&gt;
&lt;P&gt;PROC FREQ DATA=FLAGSDAT;&lt;BR /&gt;TABLE ENTRY_DATE*FLAG_VALUE / NOPERCENT NOCUM NOROW NOCOL;&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The current code's output looks like this (using a dummy dataset for speed of testing where all the timestamps are at midnight):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;31DEC2023:00:00:00 ‚ 9&lt;BR /&gt;01JAN2024:00:00:00 ‚ 11&lt;BR /&gt;22JAN2024:00:00:00 ‚ 13&lt;BR /&gt;13FEB024:00:00:00 ‚ 12&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried using this code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC FREQ DATA=FLAGSDAT;&lt;BR /&gt;TABLE ENTRY_DATE*FLAG_VALUE / NOPERCENT NOCUM NOROW NOCOL;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;FORMAT ENTRY_DATE MONYY.;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But that did not work.&amp;nbsp; Any advice for a simple fix to get the dates in the PROC FREQ output to just be MONYY or MONYYYY?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For my dummy data, I would like the output to look like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DEC2023&amp;nbsp; 9&lt;/P&gt;
&lt;P&gt;JAN2024&amp;nbsp; 24&lt;/P&gt;
&lt;P&gt;FEB2024 12&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2024 20:08:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-month-year-frequency-of-data-with-timestamp-format/m-p/928307#M365235</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-05-14T20:08:55Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get month/year frequency of data with timestamp format DATETIME20. ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-month-year-frequency-of-data-with-timestamp-format/m-p/928424#M365279</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input entry_date :datetime20.;
  format entry_date  datetime20.;
  datalines;
16FEB2021:07:02:19
28MAR2023:11:52:22
29MAR2023:11:52:22
06JAN2024:17:23:51
21APR2024:23:02:38
;

proc freq data=have;
  table entry_date ;
  format entry_date dtmonyy7.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 May 2024 02:15:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-month-year-frequency-of-data-with-timestamp-format/m-p/928424#M365279</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-05-15T02:15:32Z</dc:date>
    </item>
  </channel>
</rss>

