<?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: Char Date to SAS Date in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Char-Date-to-SAS-Date/m-p/479753#M31124</link>
    <description>&lt;P&gt;SAS dates have a month day component attached. What would you want 2018 Q1 mapped to?&lt;/P&gt;
&lt;P&gt;You can still display it in a similar format.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data demo;
*numeric date;
date='01Jan2018'd;
*character date;
date_char = 'Q12018';

*conversion;
date_num = mdy(input(substr(date_char, 2, 1), 8.)*3, 
            1, 
            input(substr(date_char, 3), 8.)
            );

*apply formats for display;
format date date_num yyq6.;
run;

proc print data=demo;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/222051"&gt;@aakash93&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi I'm quite new to SAS. With that said, I'm trying to convert a character date&amp;nbsp;in the format of "Q12018" to SAS date. Preferably in the same format or similar format.&amp;nbsp;Any help would be appreciated!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 19 Jul 2018 23:09:49 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-07-19T23:09:49Z</dc:date>
    <item>
      <title>Char Date to SAS Date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Char-Date-to-SAS-Date/m-p/479752#M31123</link>
      <description>&lt;P&gt;Hi I'm quite new to SAS. With that said, I'm trying to convert a character date&amp;nbsp;in the format of "Q12018" to SAS date. Preferably in the same format or similar format.&amp;nbsp;Any help would be appreciated!&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 23:04:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Char-Date-to-SAS-Date/m-p/479752#M31123</guid>
      <dc:creator>aakash93</dc:creator>
      <dc:date>2018-07-19T23:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: Char Date to SAS Date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Char-Date-to-SAS-Date/m-p/479753#M31124</link>
      <description>&lt;P&gt;SAS dates have a month day component attached. What would you want 2018 Q1 mapped to?&lt;/P&gt;
&lt;P&gt;You can still display it in a similar format.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data demo;
*numeric date;
date='01Jan2018'd;
*character date;
date_char = 'Q12018';

*conversion;
date_num = mdy(input(substr(date_char, 2, 1), 8.)*3, 
            1, 
            input(substr(date_char, 3), 8.)
            );

*apply formats for display;
format date date_num yyq6.;
run;

proc print data=demo;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/222051"&gt;@aakash93&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi I'm quite new to SAS. With that said, I'm trying to convert a character date&amp;nbsp;in the format of "Q12018" to SAS date. Preferably in the same format or similar format.&amp;nbsp;Any help would be appreciated!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 23:09:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Char-Date-to-SAS-Date/m-p/479753#M31124</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-07-19T23:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: Char Date to SAS Date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Char-Date-to-SAS-Date/m-p/479760#M31125</link>
      <description>&lt;P&gt;One approach:&lt;/P&gt;
&lt;PRE&gt;data example;
   char='Q12018';
   datenum= input(strip(catt(substr(char,3),substr(char,1,2))),yyq7.);
   put datenum=date9. datenum=yyq.;
run;&lt;/PRE&gt;
&lt;P&gt;The yyq informat assigns the first day of the calendar quarter as the actual date value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 23:32:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Char-Date-to-SAS-Date/m-p/479760#M31125</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-07-19T23:32:49Z</dc:date>
    </item>
    <item>
      <title>Re: Char Date to SAS Date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Char-Date-to-SAS-Date/m-p/479893#M31138</link>
      <description>&lt;P&gt;It&amp;nbsp;worked,&amp;nbsp;I appreciate it!&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2018 14:41:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Char-Date-to-SAS-Date/m-p/479893#M31138</guid>
      <dc:creator>aakash93</dc:creator>
      <dc:date>2018-07-20T14:41:46Z</dc:date>
    </item>
  </channel>
</rss>

