<?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: Convert qtr to start date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Convert-qtr-to-start-date/m-p/866300#M342108</link>
    <description>&lt;P&gt;The DATE informat needs strings in the style ddMONyyyy.&amp;nbsp; So strings like 01DEC1990 or 01-dec-1990 etc.&lt;/P&gt;
&lt;P&gt;To read a string in the style of yyyy-mm you would need a different informat.&amp;nbsp; I think you might have to append a day of the month to get it to work.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  mon_intrvl='2022-12';
  sales_date = input(cats(mon_intrvl,'-01'), yymmdd10.);
  put sales_date=date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Your second mistake is you did not include the OFFSET for the INTNX() function call.&amp;nbsp; So it is trying to convert the letter B into a number.&amp;nbsp; To get the beginning of the current month use an offset of 0 months.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  start_date_edh = intnx("month",today(),0,"b");
  format start_date_edh date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 25 Mar 2023 21:12:14 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2023-03-25T21:12:14Z</dc:date>
    <item>
      <title>Convert qtr to start date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-qtr-to-start-date/m-p/866290#M342101</link>
      <description>&lt;P&gt;1) I'm getting the invalid argument warning when I executed the following code and I see the value of sales_date as missing instead of '01DEC2022'd.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data test;
mon_intrvl='2022-12';
sales_date = input(mon_intrvl, date9.);
run;&lt;/PRE&gt;
&lt;P&gt;2) How to convert any given date value to th start date of the month? For example if input date value is&amp;nbsp; '22DEC2022' then I need the result as '01DEC2022'd. I tried the intnx function as below but it's not working.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data test;
start_date_edh = intnx("month",today(),"b");
run;&lt;/PRE&gt;
&lt;P&gt;Warning which I got is,&lt;/P&gt;
&lt;PRE&gt;NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).
      82:40   
NOTE: Invalid numeric data, 'b' , at line 82 column 40.
start_date_edh=. _ERROR_=1 _N_=1&lt;/PRE&gt;
&lt;P&gt;Any help to resolve this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Mar 2023 19:09:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-qtr-to-start-date/m-p/866290#M342101</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2023-03-25T19:09:24Z</dc:date>
    </item>
    <item>
      <title>Re: Convert qtr to start date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-qtr-to-start-date/m-p/866295#M342104</link>
      <description>&lt;P&gt;If you are getting errors, show us the log.&lt;/P&gt;</description>
      <pubDate>Sat, 25 Mar 2023 20:28:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-qtr-to-start-date/m-p/866295#M342104</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-03-25T20:28:36Z</dc:date>
    </item>
    <item>
      <title>Re: Convert qtr to start date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-qtr-to-start-date/m-p/866296#M342105</link>
      <description>&lt;P&gt;Maxim 1. Read the Documentation.&lt;/P&gt;
&lt;P&gt;Study&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/leforinforref/p106m1k307c61in1hyfymetc7uh3.htm" target="_blank" rel="noopener"&gt;DATEw. Informat&lt;/A&gt;&amp;nbsp;and you'll see your mistake.&lt;/P&gt;</description>
      <pubDate>Sat, 25 Mar 2023 20:49:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-qtr-to-start-date/m-p/866296#M342105</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-03-25T20:49:36Z</dc:date>
    </item>
    <item>
      <title>Re: Convert qtr to start date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-qtr-to-start-date/m-p/866300#M342108</link>
      <description>&lt;P&gt;The DATE informat needs strings in the style ddMONyyyy.&amp;nbsp; So strings like 01DEC1990 or 01-dec-1990 etc.&lt;/P&gt;
&lt;P&gt;To read a string in the style of yyyy-mm you would need a different informat.&amp;nbsp; I think you might have to append a day of the month to get it to work.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  mon_intrvl='2022-12';
  sales_date = input(cats(mon_intrvl,'-01'), yymmdd10.);
  put sales_date=date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Your second mistake is you did not include the OFFSET for the INTNX() function call.&amp;nbsp; So it is trying to convert the letter B into a number.&amp;nbsp; To get the beginning of the current month use an offset of 0 months.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  start_date_edh = intnx("month",today(),0,"b");
  format start_date_edh date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Mar 2023 21:12:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-qtr-to-start-date/m-p/866300#M342108</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-03-25T21:12:14Z</dc:date>
    </item>
    <item>
      <title>Re: Convert qtr to start date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-qtr-to-start-date/m-p/866309#M342109</link>
      <description>&lt;P&gt;Once you get rid of the hyphen (use COMPRESS()), you can use the YYMMN6. informat.&lt;/P&gt;</description>
      <pubDate>Sat, 25 Mar 2023 21:26:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-qtr-to-start-date/m-p/866309#M342109</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-03-25T21:26:49Z</dc:date>
    </item>
  </channel>
</rss>

