<?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 read date from txt file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/read-date-from-txt-file/m-p/70702#M15289</link>
    <description>How to read date jan 2010 as 01-2010 from the following txt file?&lt;BR /&gt;
S:\FSPR\TMOP\SAS\INFILES\txtfiles\Jan 2010 ZUD.txt</description>
    <pubDate>Wed, 09 Feb 2011 16:31:26 GMT</pubDate>
    <dc:creator>SASPhile</dc:creator>
    <dc:date>2011-02-09T16:31:26Z</dc:date>
    <item>
      <title>read date from txt file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/read-date-from-txt-file/m-p/70702#M15289</link>
      <description>How to read date jan 2010 as 01-2010 from the following txt file?&lt;BR /&gt;
S:\FSPR\TMOP\SAS\INFILES\txtfiles\Jan 2010 ZUD.txt</description>
      <pubDate>Wed, 09 Feb 2011 16:31:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/read-date-from-txt-file/m-p/70702#M15289</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2011-02-09T16:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: read date from txt file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/read-date-from-txt-file/m-p/70703#M15290</link>
      <description>Hello,&lt;BR /&gt;
&lt;BR /&gt;
&lt;P&gt; If I understand it correctly, this may help you: &lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
%let test=%str(S:\FSPR\TMOP\SAS\INFILES\txtfiles\Jan 2010 ZUD.txt);&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
*begin reading from interior:&lt;BR /&gt;
	1. substract the last part of the string:&lt;BR /&gt;
scan("&amp;amp;test",-1,'\'&lt;BR /&gt;
	2. find out the first blank in the extracted string (notice the use of 1- length("&amp;amp;test") which determines the function to look form right to left): &lt;BR /&gt;
find(scan("&amp;amp;test",-1,'\'),' ',1-length("&amp;amp;test"))&lt;BR /&gt;
	3. Use the substr function to extract Jan 2010&lt;BR /&gt;
	4. You will get a character variable which has the value Jan 2010;&lt;BR /&gt;
x=substr(scan("&amp;amp;test",-1,'\'),1,find(scan("&amp;amp;test",-1,'\'),' ',1-length("&amp;amp;test")));&lt;BR /&gt;
*transform the character variable to numeric variable so you can output it with whatever format you want;&lt;BR /&gt;
b=input(x,monyy8.);&lt;BR /&gt;
put b mmyyd.;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;P&gt;Marius&lt;/P&gt;</description>
      <pubDate>Wed, 09 Feb 2011 20:31:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/read-date-from-txt-file/m-p/70703#M15290</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2011-02-09T20:31:26Z</dc:date>
    </item>
  </channel>
</rss>

