<?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: Macro for Proc Import Excel file xlsx in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Macro-for-Proc-Import-Excel-file-xlsx/m-p/420118#M67856</link>
    <description>I have the same problem! When I import a individual xlsx file, it works well. But when I copy the import code importing individual file to macro, sas gives the same error message as you provide.</description>
    <pubDate>Mon, 11 Dec 2017 14:26:47 GMT</pubDate>
    <dc:creator>owenwqp1</dc:creator>
    <dc:date>2017-12-11T14:26:47Z</dc:date>
    <item>
      <title>Macro for Proc Import Excel file xlsx</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-for-Proc-Import-Excel-file-xlsx/m-p/311292#M61336</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having an issue with trying to use proc import in a macro for an .xlsx Excel file. Below is my code and the error message from the log.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;60 %macro pharma (a,b);&lt;BR /&gt;61 proc import out = &amp;amp;a&lt;BR /&gt;62 datafile = "C:\SUM_2016\SUM2016_HW\project2\&amp;amp;b"&lt;BR /&gt;63 dbms = xlsx replace;&lt;BR /&gt;64 getnames = yes;&lt;BR /&gt;65 mixed = yes;&lt;BR /&gt;66 datarow = 2;&lt;BR /&gt;67 run;&lt;BR /&gt;68 %mend pharma;&lt;BR /&gt;69 %pharma (project2, project2.xlsx)&lt;BR /&gt;NOTE: The previous statement has been deleted.&lt;BR /&gt;NOTE: The previous statement has been deleted.&lt;BR /&gt;NOTE: Line generated by the invoked macro "PHARMA".&lt;BR /&gt;1 getnames = yes; mixed = yes; datarow = 2; run;&lt;/P&gt;&lt;P&gt;-----&lt;/P&gt;&lt;P&gt;180&lt;/P&gt;&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My question is, why is SAS telling me getnames=yes; mixed=yes; datarow=2;&amp;nbsp; is not valid or is used out of proper oder? Can you not use these statements when importing a .xlsx file?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I take out getnames=yes; mixed=yes; datarow=2 and run the program, it runs correctly with the below log. Any help in understanding this will be very much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;53 %macro pharma (a,b);&lt;BR /&gt;54 proc import out = &amp;amp;a&lt;BR /&gt;55 datafile = "C:\SUM_2016\SUM2016_HW\project2\&amp;amp;b"&lt;BR /&gt;56 dbms = xlsx replace;&lt;BR /&gt;57 run;&lt;BR /&gt;58 %mend pharma;&lt;BR /&gt;59 %pharma (project2, project2.xlsx)&lt;/P&gt;&lt;P&gt;NOTE: The import data set has 5 observations and 27 variables.&lt;BR /&gt;NOTE: WORK.PROJECT2 data set was successfully created.&lt;BR /&gt;NOTE: PROCEDURE IMPORT used (Total process time):&lt;BR /&gt;real time 0.86 seconds&lt;BR /&gt;cpu time 0.04 seconds&lt;/P&gt;</description>
      <pubDate>Sun, 13 Nov 2016 23:24:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-for-Proc-Import-Excel-file-xlsx/m-p/311292#M61336</guid>
      <dc:creator>PDMAUL</dc:creator>
      <dc:date>2016-11-13T23:24:46Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for Proc Import Excel file xlsx</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-for-Proc-Import-Excel-file-xlsx/m-p/311294#M61337</link>
      <description>&lt;P&gt;Please post your code, the log can change things.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, try using the MPRINT/SYMBOLGEN options to see what happens.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mprint symbolgen;

%pharma (project2, project2.xlsx);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2016 00:17:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-for-Proc-Import-Excel-file-xlsx/m-p/311294#M61337</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-11-14T00:17:04Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for Proc Import Excel file xlsx</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-for-Proc-Import-Excel-file-xlsx/m-p/311295#M61338</link>
      <description>&lt;P&gt;Hello Reeza,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code with the getnames=yes; mixed=yes; datarow=2. For some reason, it does not run with those statements. But when I take them out, the program runs correctly. This is my first time importing a .xlsx file so i'm not sure how different it is from importing a .xls file and the options that can be used within the proc import step.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro pharma (a,b);&lt;BR /&gt;proc import out = &amp;amp;a&lt;BR /&gt;datafile = "C:\SUM_2016\SUM2016_HW\project2\&amp;amp;b"&lt;BR /&gt;dbms = xlsx replace;&lt;/P&gt;&lt;P&gt;getnames = yes;&lt;/P&gt;&lt;P&gt;mixed = yes;&lt;/P&gt;&lt;P&gt;datarow = 2;&lt;BR /&gt;run;&lt;BR /&gt;%mend pharma;&lt;BR /&gt;%pharma (project2, project2.xlsx)&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2016 00:22:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-for-Proc-Import-Excel-file-xlsx/m-p/311295#M61338</guid>
      <dc:creator>PDMAUL</dc:creator>
      <dc:date>2016-11-14T00:22:52Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for Proc Import Excel file xlsx</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-for-Proc-Import-Excel-file-xlsx/m-p/311296#M61339</link>
      <description>&lt;P&gt;I don't think DATAROW is supported for DBMS=XLSX.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try it without it.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2016 00:29:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-for-Proc-Import-Excel-file-xlsx/m-p/311296#M61339</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-11-14T00:29:58Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for Proc Import Excel file xlsx</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-for-Proc-Import-Excel-file-xlsx/m-p/311298#M61340</link>
      <description>&lt;P&gt;I took datarow=2 and it still gave me the same error message. When I took out mixed=yes as well, the program ran correctly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro pharma (a,b);&lt;BR /&gt;proc import out = &amp;amp;a&lt;BR /&gt;datafile = "C:\SUM_2016\SUM2016_HW\project2\&amp;amp;b"&lt;BR /&gt;dbms = xlsx replace;&lt;BR /&gt;getnames=yes;&lt;BR /&gt;run;&lt;BR /&gt;%mend pharma;&lt;BR /&gt;%pharma (project2, project2.xlsx)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Log:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;10 %macro pharma (a,b);&lt;BR /&gt;11 proc import out = &amp;amp;a&lt;BR /&gt;12 datafile = "C:\SUM_2016\SUM2016_HW\project2\&amp;amp;b"&lt;BR /&gt;13 dbms = xlsx replace;&lt;BR /&gt;14 getnames=yes;&lt;BR /&gt;15 run;&lt;BR /&gt;16 %mend pharma;&lt;BR /&gt;17 %pharma (project2, project2.xlsx)&lt;/P&gt;&lt;P&gt;NOTE: The import data set has 5 observations and 27 variables.&lt;BR /&gt;NOTE: WORK.PROJECT2 data set was successfully created.&lt;BR /&gt;NOTE: PROCEDURE IMPORT used (Total process time):&lt;BR /&gt;real time 0.03 seconds&lt;BR /&gt;cpu time 0.03 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I guess datarow=&amp;lt;opt&amp;gt; and mixed=&amp;lt;yes/no&amp;gt; are not supported for dbms=xlsx. That is interesting. I will take note of that in my lecture notes for class. Thank you for helping me Reeza!!!.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2016 00:40:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-for-Proc-Import-Excel-file-xlsx/m-p/311298#M61340</guid>
      <dc:creator>PDMAUL</dc:creator>
      <dc:date>2016-11-14T00:40:17Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for Proc Import Excel file xlsx</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-for-Proc-Import-Excel-file-xlsx/m-p/420118#M67856</link>
      <description>I have the same problem! When I import a individual xlsx file, it works well. But when I copy the import code importing individual file to macro, sas gives the same error message as you provide.</description>
      <pubDate>Mon, 11 Dec 2017 14:26:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-for-Proc-Import-Excel-file-xlsx/m-p/420118#M67856</guid>
      <dc:creator>owenwqp1</dc:creator>
      <dc:date>2017-12-11T14:26:47Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for Proc Import Excel file xlsx</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-for-Proc-Import-Excel-file-xlsx/m-p/420124#M67857</link>
      <description>%macro sic;
	%do i=1999 %to 2011;

	PROC IMPORT OUT= WORK.digit_&amp;amp;i

            DATAFILE= "F:\statistics\digit_&amp;amp;i" 

            DBMS=xlsx REPLACE;

           sheet="fdi_2digiit_&amp;amp;i"; 

	  getnames=yes;
	     
RUN;
	%end;
	%mend;
%sic</description>
      <pubDate>Mon, 11 Dec 2017 14:39:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-for-Proc-Import-Excel-file-xlsx/m-p/420124#M67857</guid>
      <dc:creator>owenwqp1</dc:creator>
      <dc:date>2017-12-11T14:39:29Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for Proc Import Excel file xlsx</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-for-Proc-Import-Excel-file-xlsx/m-p/420129#M67858</link>
      <description>Hi PDMAUL,
   There is something wrong with my browser, and the post editor features are not working on my computer. So I attached a text doc of my code importing xlsx files with macro. Though not perfect, it works. Good luck!</description>
      <pubDate>Mon, 11 Dec 2017 14:49:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-for-Proc-Import-Excel-file-xlsx/m-p/420129#M67858</guid>
      <dc:creator>owenwqp1</dc:creator>
      <dc:date>2017-12-11T14:49:14Z</dc:date>
    </item>
  </channel>
</rss>

