<?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: Insert filename into table using datastep in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Insert-filename-into-table-using-datastep/m-p/181451#M34596</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One more question,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The filename includes the whole directory which is over 70 characters long.&amp;nbsp; The results only display the first 8 characters.&amp;nbsp; I tried using the informat to bring in all characters, but it does not work.&amp;nbsp; Ideally, I would like to use something like the substr function and only display the last few characters of the filename.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 21 Nov 2014 16:47:57 GMT</pubDate>
    <dc:creator>LAtwood</dc:creator>
    <dc:date>2014-11-21T16:47:57Z</dc:date>
    <item>
      <title>Insert filename into table using datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-filename-into-table-using-datastep/m-p/181449#M34594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using the datastep to read in a text file.&amp;nbsp; Each text file has a distinct filename.&amp;nbsp; I'm unsure how to bring the distinct filename for each record into the table?&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;libname YOKOGAWA "D:\***\*****\****\YOKOGAWA";&lt;/P&gt;&lt;P&gt;FILENAME NORM 1 &lt;A href="https://communities.sas.com/"&gt;\\**\***\SAS DATA NORMALIZER 1\NORMALIZER 1*.txt&lt;/A&gt; ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data YOKOGAWA.NORM_1_YOKOGAWA&lt;/P&gt;&lt;P&gt;%let _EFIERR_ = 0; /*set the ERROR detection macro variable/*&lt;/P&gt;&lt;P&gt;infile NORM1 delimiter = ',' MISSOVER DSD lcrecl=32767&lt;/P&gt;&lt;P&gt;firstobs=20 EOV=SKIP;&lt;/P&gt;&lt;P&gt;informat yok_dttm ANYDTDTM23.;&lt;/P&gt;&lt;P&gt;informat fpm best32.;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;input @; /*if skip then skip=0; else do; */&lt;/P&gt;&lt;P&gt;if skip then do;&lt;/P&gt;&lt;P&gt;skip=0;&lt;/P&gt;&lt;P&gt;input #19;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;else do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yok_dttm&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fpm&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;if _ERROR_ then call symputx('_EFIERR_',1);&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Nov 2014 15:57:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-filename-into-table-using-datastep/m-p/181449#M34594</guid>
      <dc:creator>LAtwood</dc:creator>
      <dc:date>2014-11-21T15:57:27Z</dc:date>
    </item>
    <item>
      <title>Re: Insert filename into table using datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-filename-into-table-using-datastep/m-p/181450#M34595</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;On the infile statement add:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FileName= TempFileName&lt;/P&gt;&lt;P&gt;This add a temporary variable that can be referenced but is not kept in the data set.&lt;/P&gt;&lt;P&gt;and in the body of the code&lt;/P&gt;&lt;P&gt;File = TempFileName;&lt;/P&gt;&lt;P&gt;this keeps the name of the file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Nov 2014 16:08:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-filename-into-table-using-datastep/m-p/181450#M34595</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-11-21T16:08:58Z</dc:date>
    </item>
    <item>
      <title>Re: Insert filename into table using datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-filename-into-table-using-datastep/m-p/181451#M34596</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One more question,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The filename includes the whole directory which is over 70 characters long.&amp;nbsp; The results only display the first 8 characters.&amp;nbsp; I tried using the informat to bring in all characters, but it does not work.&amp;nbsp; Ideally, I would like to use something like the substr function and only display the last few characters of the filename.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Nov 2014 16:47:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-filename-into-table-using-datastep/m-p/181451#M34596</guid>
      <dc:creator>LAtwood</dc:creator>
      <dc:date>2014-11-21T16:47:57Z</dc:date>
    </item>
    <item>
      <title>Re: Insert filename into table using datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-filename-into-table-using-datastep/m-p/181452#M34597</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Forgot to mention that you need to specify the length of the file variable before use&lt;/P&gt;&lt;P&gt;length file $ 70;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Nov 2014 17:00:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-filename-into-table-using-datastep/m-p/181452#M34597</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-11-21T17:00:29Z</dc:date>
    </item>
    <item>
      <title>Re: Insert filename into table using datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-filename-into-table-using-datastep/m-p/181453#M34598</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, I lied that wasn't my last question &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I have added&lt;/P&gt;&lt;P&gt;infile filename = tempfilename;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;length file $70.;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;file=tempfilename;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the log it lists the whole directory as the filename now.&amp;nbsp; However, in the sas dataset file is only showing 8 characters.&amp;nbsp; I tried adding "file" to the informat and format statements with 70 characters, but no success.&amp;nbsp; What am I missing?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Nov 2014 17:24:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-filename-into-table-using-datastep/m-p/181453#M34598</guid>
      <dc:creator>LAtwood</dc:creator>
      <dc:date>2014-11-21T17:24:08Z</dc:date>
    </item>
    <item>
      <title>Re: Insert filename into table using datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-filename-into-table-using-datastep/m-p/181454#M34599</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry found what I was missing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was missing the length for tempfilename.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks you so much for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lori&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Nov 2014 17:30:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-filename-into-table-using-datastep/m-p/181454#M34599</guid>
      <dc:creator>LAtwood</dc:creator>
      <dc:date>2014-11-21T17:30:37Z</dc:date>
    </item>
  </channel>
</rss>

