<?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: How to Print a CSV Filename into a SAS Dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-Print-a-CSV-Filename-into-a-SAS-Dataset/m-p/116417#M259364</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Add this to your infile statement ....&lt;/P&gt;&lt;P&gt;&lt;A name="n06h3lgb45a90tn10cjoqi40fpu3"&gt;&lt;/A&gt;&lt;/P&gt;&lt;DL class="argDescriptionPair"&gt;&lt;DT class="argument"&gt;FILENAME=whatever&lt;/DT&gt;&lt;DD class="argumentDescription"&gt;&lt;P class="paraSimpleFirst"&gt;specifies a variable that SAS sets to the physical name of the currently opened input file. Like automatic variables, the FILENAME= variable is not written to the data set. &lt;/P&gt;&lt;P class="summary"&gt;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN class="summaryTip"&gt;Tip:&lt;/SPAN&gt;Use a LENGTH statement to make the variable length long enough to contain the value of the filename. &lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="summarySee"&gt;See:&lt;/SPAN&gt;&lt;SPAN class="xrefSee"&gt;&lt;A _jive_internal="true" href="https://communities.sas.com/ms-its:lestmtsref.chm::/lestmtsref.hlp/n1rill4udj0tfun1fvce3j401plo.htm#p1co5raf64hklwn1m40ecoo3e76e" title=""&gt;FILEVAR=&lt;/A&gt;&lt;SPAN class="xrefText"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="summaryExampleLinks"&gt;Example:&lt;/SPAN&gt;&lt;SPAN class="xref"&gt;&lt;A _jive_internal="true" class="active_link" href="https://communities.sas.com/ms-its:lestmtsref.chm::/lestmtsref.hlp/n1rill4udj0tfun1fvce3j401plo.htm#n1x9joj5qbfkjyn1kqtm7joru0qb" title=""&gt;Reading from Multiple Input Files&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="xref"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="xref"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="xref"&gt;then module=whatever&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="xref"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="xref"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DD&gt;&lt;/DL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 20 Aug 2013 18:47:05 GMT</pubDate>
    <dc:creator>AdrianGriffin</dc:creator>
    <dc:date>2013-08-20T18:47:05Z</dc:date>
    <item>
      <title>How to Print a CSV Filename into a SAS Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Print-a-CSV-Filename-into-a-SAS-Dataset/m-p/116416#M259363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to create a variable that references the input file's filename (without extension). Is there a way to do this? I am going to combine multiple test files into one excel file so I can run pivot tables for grade reports. Using the filename would be an easy way to assign the module or test name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for example:&lt;/P&gt;&lt;P&gt;data work.test;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; infile 'C:\xxx.csv' dlm=',';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Module=&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;'INSERT CODE FOR FILENAME REFERENCE HERE'&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; length Student $20;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Input Student Grade;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; format grade percent6.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print data=work.test;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then under the variable "Module", you would see "test 1" "test 2" "test 3" etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Aug 2013 17:09:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Print-a-CSV-Filename-into-a-SAS-Dataset/m-p/116416#M259363</guid>
      <dc:creator>Wheelawake</dc:creator>
      <dc:date>2013-08-20T17:09:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to Print a CSV Filename into a SAS Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Print-a-CSV-Filename-into-a-SAS-Dataset/m-p/116417#M259364</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Add this to your infile statement ....&lt;/P&gt;&lt;P&gt;&lt;A name="n06h3lgb45a90tn10cjoqi40fpu3"&gt;&lt;/A&gt;&lt;/P&gt;&lt;DL class="argDescriptionPair"&gt;&lt;DT class="argument"&gt;FILENAME=whatever&lt;/DT&gt;&lt;DD class="argumentDescription"&gt;&lt;P class="paraSimpleFirst"&gt;specifies a variable that SAS sets to the physical name of the currently opened input file. Like automatic variables, the FILENAME= variable is not written to the data set. &lt;/P&gt;&lt;P class="summary"&gt;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN class="summaryTip"&gt;Tip:&lt;/SPAN&gt;Use a LENGTH statement to make the variable length long enough to contain the value of the filename. &lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="summarySee"&gt;See:&lt;/SPAN&gt;&lt;SPAN class="xrefSee"&gt;&lt;A _jive_internal="true" href="https://communities.sas.com/ms-its:lestmtsref.chm::/lestmtsref.hlp/n1rill4udj0tfun1fvce3j401plo.htm#p1co5raf64hklwn1m40ecoo3e76e" title=""&gt;FILEVAR=&lt;/A&gt;&lt;SPAN class="xrefText"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="summaryExampleLinks"&gt;Example:&lt;/SPAN&gt;&lt;SPAN class="xref"&gt;&lt;A _jive_internal="true" class="active_link" href="https://communities.sas.com/ms-its:lestmtsref.chm::/lestmtsref.hlp/n1rill4udj0tfun1fvce3j401plo.htm#n1x9joj5qbfkjyn1kqtm7joru0qb" title=""&gt;Reading from Multiple Input Files&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="xref"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="xref"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="xref"&gt;then module=whatever&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="xref"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="xref"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DD&gt;&lt;/DL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Aug 2013 18:47:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Print-a-CSV-Filename-into-a-SAS-Dataset/m-p/116417#M259364</guid>
      <dc:creator>AdrianGriffin</dc:creator>
      <dc:date>2013-08-20T18:47:05Z</dc:date>
    </item>
  </channel>
</rss>

