<?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: SAS macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-macro/m-p/408448#M99721</link>
    <description>&lt;P&gt;As you can see from the macro call, Code #1 expects to receive a quoted path to a file.&amp;nbsp; The macro checks to see whether that file actually exists.&amp;nbsp; If it does, it imports the file into a SAS data set named SALES.&amp;nbsp; If the file doesn't exist, the macro creates a SAS data set named SALES, holding just one observation where ID is blank and AMOUNT is 0.&lt;/P&gt;</description>
    <pubDate>Mon, 30 Oct 2017 02:41:24 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2017-10-30T02:41:24Z</dc:date>
    <item>
      <title>SAS macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-macro/m-p/408442#M99718</link>
      <description>&lt;P&gt;May I know what happened to code 1? I can import perfectly with code 2.&amp;nbsp; May I know how to make code 1 works? Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%LET YYYYMM=201710;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/**Code 1**/&lt;/P&gt;&lt;P&gt;%macro checkds(dsn);&lt;BR /&gt;%if %sysfunc(exist(&amp;amp;dsn)) %then %do;&lt;BR /&gt;PROC IMPORT OUT=sales&lt;BR /&gt;DATAFILE=&amp;amp;dsn&lt;BR /&gt;DBMS=EXCEL REPLACE;&lt;BR /&gt;getnames=yes;&lt;BR /&gt;run;&lt;BR /&gt;%end;&lt;BR /&gt;%else %do;&lt;BR /&gt;DATA sales;&lt;BR /&gt;ID='';&lt;BR /&gt;AMOUNT=0;&lt;BR /&gt;RUN;&lt;BR /&gt;%end;&lt;BR /&gt;%mend checkds;&lt;BR /&gt;%checkds("d:\test\book1_&amp;amp;YYYYMM..xlsx")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/**code 2**/&lt;/P&gt;&lt;P&gt;PROC IMPORT OUT=SALES&lt;BR /&gt;DATAFILE="d:\test\book1_&amp;amp;yyyymm..xlsx"&lt;BR /&gt;DBMS=EXCEL REPLACE;&lt;BR /&gt;getnames=yes;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2017 02:20:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-macro/m-p/408442#M99718</guid>
      <dc:creator>scb</dc:creator>
      <dc:date>2017-10-30T02:20:35Z</dc:date>
    </item>
    <item>
      <title>Re: SAS macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-macro/m-p/408448#M99721</link>
      <description>&lt;P&gt;As you can see from the macro call, Code #1 expects to receive a quoted path to a file.&amp;nbsp; The macro checks to see whether that file actually exists.&amp;nbsp; If it does, it imports the file into a SAS data set named SALES.&amp;nbsp; If the file doesn't exist, the macro creates a SAS data set named SALES, holding just one observation where ID is blank and AMOUNT is 0.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2017 02:41:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-macro/m-p/408448#M99721</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-10-30T02:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: SAS macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-macro/m-p/408497#M99740</link>
      <description>&lt;P&gt;exist() is a function that checks for the existence of a SAS dataset, so it needs an argument that describes such (&lt;EM&gt;LIBNAME.DATASET&lt;/EM&gt;). Since you want to check for an external (non-SAS) file, you need to use the fexist() function.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2017 07:01:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-macro/m-p/408497#M99740</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-10-30T07:01:07Z</dc:date>
    </item>
  </channel>
</rss>

