<?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 do I Import an excel file using macro statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-Import-an-excel-file-using-macro-statement/m-p/283221#M57699</link>
    <description>&lt;P&gt;THANK YOU THANK YOU!! This fixed everything.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 10 Jul 2016 19:20:57 GMT</pubDate>
    <dc:creator>boodaloo1</dc:creator>
    <dc:date>2016-07-10T19:20:57Z</dc:date>
    <item>
      <title>How do I Import an excel file using macro statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-Import-an-excel-file-using-macro-statement/m-p/283217#M57696</link>
      <description>&lt;P&gt;I have to create a macro statement to extract an excel file from my computer. I have the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/SPAN&gt; one (a, b, c);&lt;/P&gt;&lt;P&gt;proc import out= &amp;amp;a&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;datafile= &lt;/SPAN&gt;"\\Client\H&amp;amp;\Desktop\&amp;amp;b"&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;dbms=xlsx replace;&lt;/P&gt;&lt;P&gt;getnames=yes;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sort data=&amp;amp;a;&lt;/P&gt;&lt;P&gt;by &amp;amp;c;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/SPAN&gt; one;&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;one&lt;/I&gt;&lt;/STRONG&gt; (data1, datafileone.xlsx, id);&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;one&lt;/I&gt;&lt;/STRONG&gt; (data2, datafiletwo.xlsx, id);&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;one&lt;/I&gt;&lt;/STRONG&gt; (data3, datafilethree.xlsx, id);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get the following errors:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order. (regarding the dbms=xlsx replace statement)&lt;/P&gt;&lt;P&gt;My computer then tells me that my files don't exist, which I am assuming is because the statement above is not working properly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone have any advice on how to fix this problem?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Jul 2016 18:26:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-Import-an-excel-file-using-macro-statement/m-p/283217#M57696</guid>
      <dc:creator>boodaloo1</dc:creator>
      <dc:date>2016-07-10T18:26:04Z</dc:date>
    </item>
    <item>
      <title>Re: How do I Import an excel file using macro statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-Import-an-excel-file-using-macro-statement/m-p/283219#M57697</link>
      <description>&lt;P&gt;Always test your code outside of a macro loop.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let a=data1;
%let b=datafileone.xlsx;


proc import out= &amp;amp;a
datafile= "\\Client\H&amp;amp;\Desktop\&amp;amp;b";
dbms=xlsx replace;
getnames=yes;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In this case your semicolon is too early, you don't need the one after the datafile statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let a=data1;
%let b=datafileone.xlsx;


proc import out= &amp;amp;a
datafile= "\\Client\H&amp;amp;\Desktop\&amp;amp;b"
dbms=xlsx replace;
getnames=yes;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 10 Jul 2016 19:02:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-Import-an-excel-file-using-macro-statement/m-p/283219#M57697</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-07-10T19:02:57Z</dc:date>
    </item>
    <item>
      <title>Re: How do I Import an excel file using macro statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-Import-an-excel-file-using-macro-statement/m-p/283220#M57698</link>
      <description>&lt;P&gt;You have H&amp;amp; in the filepath. If the path actually has a &amp;amp; it may generate a warning, but should still work.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ideally you don't want that symbol in your path.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Jul 2016 19:03:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-Import-an-excel-file-using-macro-statement/m-p/283220#M57698</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-07-10T19:03:55Z</dc:date>
    </item>
    <item>
      <title>Re: How do I Import an excel file using macro statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-Import-an-excel-file-using-macro-statement/m-p/283221#M57699</link>
      <description>&lt;P&gt;THANK YOU THANK YOU!! This fixed everything.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Jul 2016 19:20:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-Import-an-excel-file-using-macro-statement/m-p/283221#M57699</guid>
      <dc:creator>boodaloo1</dc:creator>
      <dc:date>2016-07-10T19:20:57Z</dc:date>
    </item>
  </channel>
</rss>

