<?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: PROC IMPORT changing file name in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/PROC-IMPORT-changing-file-name/m-p/101946#M8950</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm still new to sas, so I appreciate your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The macro variable sounds like what I'm looking for this scenerio, while the prompt could actually be useful for another program I made.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you have reference links or examples that could help me understand how to do this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 02 Oct 2013 21:18:27 GMT</pubDate>
    <dc:creator>EarlyCode</dc:creator>
    <dc:date>2013-10-02T21:18:27Z</dc:date>
    <item>
      <title>PROC IMPORT changing file name</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/PROC-IMPORT-changing-file-name/m-p/101944#M8948</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a .sas program set up to import a dataset from excel, run analysis, and export the result to a new tab in the same excel file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, everymonth the file name changes. So last month the file was File-2013090101(1).XLS, this month it will be File-2013100101(1).XLS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Always in the format of "File-YYYYMMDD01(1).XLS" for the first of the current month. I don't create the file, so I have no control over the naming convention.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Currently, everytime I run the program I have to first go into the code and manually update the file name to the new name. Is there a way to automate that so when the file becomes available I just need to execute the .sas program and it will automatically select the newest file?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried searching for PROC IMPORT help, but I couldn't find this scenerio. So naturally if this was previously discussed I appologize.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC IMPORT OUT= WORK.TABLEABC&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATAFILE= "&amp;lt;FILE-PATH&amp;gt;\FILE-2013090101(1).XLS"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DBMS=EXCEL REPLACE;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SHEET= "sheet1$";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GETNAMES=YES;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MIXED=NO;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SCANTEXT=YES;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; USEDATE=YES;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SCANTIME=YES;&lt;/P&gt;&lt;P&gt;Run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Oct 2013 19:54:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/PROC-IMPORT-changing-file-name/m-p/101944#M8948</guid>
      <dc:creator>EarlyCode</dc:creator>
      <dc:date>2013-10-02T19:54:25Z</dc:date>
    </item>
    <item>
      <title>Re: PROC IMPORT changing file name</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/PROC-IMPORT-changing-file-name/m-p/101945#M8949</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could either use prompts which lets you insert the file name, or you could use date functions to calculate the file name based on the current date,&amp;nbsp; and store the result in a macro variable (which you reference in proc import)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Oct 2013 21:01:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/PROC-IMPORT-changing-file-name/m-p/101945#M8949</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2013-10-02T21:01:06Z</dc:date>
    </item>
    <item>
      <title>Re: PROC IMPORT changing file name</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/PROC-IMPORT-changing-file-name/m-p/101946#M8950</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm still new to sas, so I appreciate your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The macro variable sounds like what I'm looking for this scenerio, while the prompt could actually be useful for another program I made.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you have reference links or examples that could help me understand how to do this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Oct 2013 21:18:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/PROC-IMPORT-changing-file-name/m-p/101946#M8950</guid>
      <dc:creator>EarlyCode</dc:creator>
      <dc:date>2013-10-02T21:18:27Z</dc:date>
    </item>
    <item>
      <title>Re: PROC IMPORT changing file name</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/PROC-IMPORT-changing-file-name/m-p/101947#M8951</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think you need a macro variable.&amp;nbsp; Couldn't you accomplish what you want by simply using something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC IMPORT OUT= WORK.TABLEABC&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATAFILE= "d:\art\FILE-%sysfunc(date(),yymmn6.)0101(1).XLS"&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DBMS=EXCEL REPLACE;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SHEET= "sheet1$";&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GETNAMES=YES;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MIXED=NO;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SCANTEXT=YES;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; USEDATE=YES;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SCANTIME=YES;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Oct 2013 21:52:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/PROC-IMPORT-changing-file-name/m-p/101947#M8951</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-10-02T21:52:51Z</dc:date>
    </item>
    <item>
      <title>Re: PROC IMPORT changing file name</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/PROC-IMPORT-changing-file-name/m-p/101948#M8952</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you walk me through the syntax of the sysfunc?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Because that seems to work, and I would love to understand how.&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Oct 2013 22:11:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/PROC-IMPORT-changing-file-name/m-p/101948#M8952</guid>
      <dc:creator>EarlyCode</dc:creator>
      <dc:date>2013-10-02T22:11:15Z</dc:date>
    </item>
    <item>
      <title>Re: PROC IMPORT changing file name</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/PROC-IMPORT-changing-file-name/m-p/101949#M8953</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not a lot to walk through.&amp;nbsp; %sysfunc is a macro function that lets one execute sas functions.&amp;nbsp; Its specs are:&lt;/P&gt;&lt;P&gt;&lt;SPAN class="strong" style="font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; font-weight: bold; color: #000000; background-color: #ffffff;"&gt;%SYSFUNC&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt; (&lt;/SPAN&gt;&lt;SPAN class="emph" style="font-style: italic; color: #000000; font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;function&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="emph" style="font-style: italic; color: #000000; font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;argument-1 &amp;lt;...argument-n&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;)&amp;lt;, &lt;/SPAN&gt;&lt;SPAN class="emph" style="font-style: italic; color: #000000; font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;and it is documented at:&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#z3514sysfunc.htm" title="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#z3514sysfunc.htm"&gt;SAS(R) 9.2 Macro Language: Reference&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN style="color: #000000; font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; line-height: 16.796875px; background-color: #ffffff;"&gt;In this case (i.e., &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;-%sysfunc(date(),yymmn6.)&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ), it is simply executing the date() function (i.e., returning today's date) using the yymmn6. format, which will return 201310&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #000000; font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; line-height: 16.796875px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #000000; font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; line-height: 16.796875px; background-color: #ffffff;"&gt;Since you filenames always contain &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;FILE-&lt;/SPAN&gt;yyyymm0101(1).xls, that was all that varied.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #000000; font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; line-height: 16.796875px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Oct 2013 22:25:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/PROC-IMPORT-changing-file-name/m-p/101949#M8953</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-10-02T22:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: PROC IMPORT changing file name</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/PROC-IMPORT-changing-file-name/m-p/101950#M8954</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And the yymmn6 is specifying the format to give the year first, then month, and n6= contained in 6 characters?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So if it was yymmddn6 it would return 131002, or if I needed it in another order, mmyyn6 would return 102013?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Varying file names by just the date is common around here, but they don't always follow the same format. So this should be very useful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Oct 2013 22:38:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/PROC-IMPORT-changing-file-name/m-p/101950#M8954</guid>
      <dc:creator>EarlyCode</dc:creator>
      <dc:date>2013-10-02T22:38:28Z</dc:date>
    </item>
    <item>
      <title>Re: PROC IMPORT changing file name</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/PROC-IMPORT-changing-file-name/m-p/101951#M8955</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The wide variety and versatility of SAS formats, and the fact that you can always create your own when needed, are two of the features that have always made SAS so versatile.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For an overview of most of the available formats take a look at: &lt;A href="http://support.sas.com/documentation/cdl/en/leforinforref/63324/HTML/default/viewer.htm#n0p2fmevfgj470n17h4k9f27qjag.htm" title="http://support.sas.com/documentation/cdl/en/leforinforref/63324/HTML/default/viewer.htm#n0p2fmevfgj470n17h4k9f27qjag.htm"&gt;SAS(R) 9.3 Formats and Informats: Reference&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Oct 2013 22:44:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/PROC-IMPORT-changing-file-name/m-p/101951#M8955</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-10-02T22:44:50Z</dc:date>
    </item>
  </channel>
</rss>

