<?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 Converting dates from external file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Converting-dates-from-external-file/m-p/340076#M272643</link>
    <description>&lt;P&gt;I have the data in the attached .csv file; the Date variable containes future dates for the appropriate Index.&amp;nbsp;The Date variable&amp;nbsp;gets imported into&amp;nbsp;SAS as a character variable&amp;nbsp;after I&amp;nbsp;use the appropriate proc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to either a) import the variable&amp;nbsp;into SAS as a numeric variable or b) convert the variable into numeric &lt;EM&gt;after&lt;/EM&gt; I have imported it into SAS. Also, I would appreciate any thoughts on how I can deal with the issue that some of my values in the&amp;nbsp;Date variable show up as mmm-yy, rather than yy-mmm.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would appreciate any insight that you may have to offer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
    <pubDate>Fri, 10 Mar 2017 19:32:59 GMT</pubDate>
    <dc:creator>maroulator</dc:creator>
    <dc:date>2017-03-10T19:32:59Z</dc:date>
    <item>
      <title>Converting dates from external file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-dates-from-external-file/m-p/340076#M272643</link>
      <description>&lt;P&gt;I have the data in the attached .csv file; the Date variable containes future dates for the appropriate Index.&amp;nbsp;The Date variable&amp;nbsp;gets imported into&amp;nbsp;SAS as a character variable&amp;nbsp;after I&amp;nbsp;use the appropriate proc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to either a) import the variable&amp;nbsp;into SAS as a numeric variable or b) convert the variable into numeric &lt;EM&gt;after&lt;/EM&gt; I have imported it into SAS. Also, I would appreciate any thoughts on how I can deal with the issue that some of my values in the&amp;nbsp;Date variable show up as mmm-yy, rather than yy-mmm.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would appreciate any insight that you may have to offer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2017 19:32:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-dates-from-external-file/m-p/340076#M272643</guid>
      <dc:creator>maroulator</dc:creator>
      <dc:date>2017-03-10T19:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: Converting dates from external file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-dates-from-external-file/m-p/340082#M272644</link>
      <description>&lt;P&gt;You can only read into a character variable; next use the position of the hyphen (determine with indexc()) to decide how to correct the order and drop the hyphen with substr(), so all entries are structured as MMMYY. After prepending "01" as day you can use input(chardate,date7.) to convert to a SAS date.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2017 19:54:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-dates-from-external-file/m-p/340082#M272644</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-03-10T19:54:34Z</dc:date>
    </item>
    <item>
      <title>Re: Converting dates from external file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-dates-from-external-file/m-p/340084#M272645</link>
      <description>&lt;P&gt;I would import them as character then deal with them in SAS. &amp;nbsp;You can check the values and convert them depending on the source value. For instance you can check if the first character is numeric then create a date using the first value* as the year, and the second** as the month in the MDY function. &amp;nbsp;Conversely if the first character is a letter, use the first value as the month and the second as the year in the same function. &amp;nbsp;You'd have to supply a value for the day as mentioned in the previous answer.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;* scan(date, 1, '-');&lt;/P&gt;
&lt;P&gt;** scan(date, 2, '-');&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2017 20:00:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-dates-from-external-file/m-p/340084#M272645</guid>
      <dc:creator>evp000</dc:creator>
      <dc:date>2017-03-10T20:00:13Z</dc:date>
    </item>
  </channel>
</rss>

