<?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 Data string to Date String MONYY7. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Convert-Data-string-to-Date-String-MONYY7/m-p/176613#M33837</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Replace&lt;/P&gt;&lt;P&gt;"&amp;amp;sysdate" AS Extract_Date&lt;/P&gt;&lt;P&gt;with&lt;/P&gt;&lt;P&gt;input("&amp;amp;sysdate.", date9.) AS Extract_Date&amp;nbsp; format=monyy7.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BTW, if what you want is Today's date, then using date() or today() maybe more straightforward.&lt;/P&gt;&lt;P&gt;date()&amp;nbsp;&amp;nbsp; AS Extract_Date&amp;nbsp; format=monyy7.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 09 Jan 2015 19:08:51 GMT</pubDate>
    <dc:creator>Haikuo</dc:creator>
    <dc:date>2015-01-09T19:08:51Z</dc:date>
    <item>
      <title>Convert Data string to Date String MONYY7.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Data-string-to-Date-String-MONYY7/m-p/176612#M33836</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am running the code below.&amp;nbsp; I added the sysdate to my first 2 tables.&amp;nbsp; The sysdate keeps coming out as a character string.&amp;nbsp; I would like to change it to a date string and only display the month and year (MONYY7.)&amp;nbsp; Can anyone please assist me with modifiying my current code or adding a data step to convert the character string to a date string and display month and year only. ex the date right now is diplayed as 09JAN15 which is formated as CHAR7.&amp;nbsp; I would like to display the date as JAN2015.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE work.mobpp1 AS&lt;BR /&gt;SELECT DISTINCT soc, feature_code, rate, &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; datepart(effective_date)format=mmddyy10. AS effective_date,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; datepart(sys_creation_date)format=mmddyy10. AS sys_creation_date, &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; datepart(expiration_date)format=mmddyy10. AS expiration_date, &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "&amp;amp;sysdate" as Extract_Date&lt;BR /&gt;FROM bmlrwork.pp_rc_rate&lt;BR /&gt;WHERE expiration_date =.;&lt;BR /&gt;QUIT;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;DATA work.mobpp1; &lt;BR /&gt;INPUT Extract_Date $7.;&lt;BR /&gt;FMTExtract_Date= INPUT(Extract_Date,monyy7.);&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE work.mobpp2 AS&lt;BR /&gt;SELECT DISTINCT soc, soc_description, product_type, "&amp;amp;sysdate" AS Extract_Date&lt;BR /&gt;FROM bmlrwork.soc&lt;BR /&gt;WHERE expiration_date =.;&lt;BR /&gt;QUIT;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE work.mobpp3 AS&lt;BR /&gt;SELECT DISTINCT t1.soc, t1.feature_code, t1.rate, t1.effective_date, t1.sys_creation_date, t1.expiration_date, &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; t2.soc_description, t2.product_type, t2.Extract_Date&lt;BR /&gt;FROM work.mobpp1 AS t1 &lt;BR /&gt;LEFT JOIN work.mobpp2 AS t2&lt;BR /&gt;ON t1.soc = t2.soc;&lt;BR /&gt;QUIT;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Giuliano Filoso&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Jan 2015 18:53:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Data-string-to-Date-String-MONYY7/m-p/176612#M33836</guid>
      <dc:creator>Giuliano</dc:creator>
      <dc:date>2015-01-09T18:53:01Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Data string to Date String MONYY7.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Data-string-to-Date-String-MONYY7/m-p/176613#M33837</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Replace&lt;/P&gt;&lt;P&gt;"&amp;amp;sysdate" AS Extract_Date&lt;/P&gt;&lt;P&gt;with&lt;/P&gt;&lt;P&gt;input("&amp;amp;sysdate.", date9.) AS Extract_Date&amp;nbsp; format=monyy7.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BTW, if what you want is Today's date, then using date() or today() maybe more straightforward.&lt;/P&gt;&lt;P&gt;date()&amp;nbsp;&amp;nbsp; AS Extract_Date&amp;nbsp; format=monyy7.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Jan 2015 19:08:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Data-string-to-Date-String-MONYY7/m-p/176613#M33837</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2015-01-09T19:08:51Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Data string to Date String MONYY7.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Data-string-to-Date-String-MONYY7/m-p/176614#M33838</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;just add &lt;STRONG&gt;d&lt;/STRONG&gt; after your sysdate variable and you will have the corresponding numeric sas vaue which can be formatted at your will.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;PROC SQL;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;CREATE TABLE work.mobpp1 AS&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;SELECT DISTINCT soc, feature_code, rate, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; datepart(effective_date)format=mmddyy10. AS effective_date,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; datepart(sys_creation_date)format=mmddyy10. AS sys_creation_date, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; datepart(expiration_date)format=mmddyy10. AS expiration_date, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "&amp;amp;sysdate"d&lt;/STRONG&gt; as Extract_Date&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;FROM bmlrwork.pp_rc_rate&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;WHERE expiration_date =.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;QUIT;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Jan 2015 19:41:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Data-string-to-Date-String-MONYY7/m-p/176614#M33838</guid>
      <dc:creator>Loko</dc:creator>
      <dc:date>2015-01-09T19:41:38Z</dc:date>
    </item>
  </channel>
</rss>

