<?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: target is empty? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/coordination-of-libname-statemen/m-p/943794#M369880</link>
    <description>&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 68&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;options mrecall;&lt;/LI&gt;&lt;LI&gt;%macro importXLSX(data,data2,getnames);&lt;/LI&gt;&lt;LI&gt;options validVarName=any;&lt;/LI&gt;&lt;LI&gt;proc import datafile="/home/u63984272/macros/&amp;amp;data..xlsx"&lt;/LI&gt;&lt;LI&gt;dbms=xlsx&lt;/LI&gt;&lt;LI&gt;out=&amp;amp;data2&lt;/LI&gt;&lt;LI&gt;replace;&lt;/LI&gt;&lt;LI&gt;getnames=&amp;amp;getnames;&lt;/LI&gt;&lt;LI&gt;sheet="Sheet2";&lt;/LI&gt;&lt;LI&gt;*datarow=n;&lt;/LI&gt;&lt;LI&gt;*range="range name";&lt;/LI&gt;&lt;LI&gt;*mixed=yes;&lt;/LI&gt;&lt;LI&gt;run; quit;&lt;/LI&gt;&lt;LI&gt;%mend importXLSX; 83&lt;/LI&gt;&lt;LI&gt;options dlcreatedir;&lt;/LI&gt;&lt;LI&gt;libname target "/home/u63984272/macros"; NOTE: Libref TARGET was successfully assigned as follows:&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Engine:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; V9&lt;/P&gt;&lt;P&gt;Physical Name: /home/u63984272/macros&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;%importXLSX(data=sheet2.XLSX,data2=target.sheet2,getnames=yes);&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: Physical file does not exist, /home/u63984272/macros//sheet2.XLSX. NOTE: The SAS System stopped processing this step because of errors.&lt;/P&gt;&lt;P&gt;NOTE: PROCEDURE IMPORT used (Total process time):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;folder target is empty and sheet2.xlsx is only in&amp;nbsp;/home/u63984272/macros//sheet2.XLSX.&lt;/P&gt;</description>
    <pubDate>Fri, 13 Sep 2024 13:28:11 GMT</pubDate>
    <dc:creator>MMSTAT</dc:creator>
    <dc:date>2024-09-13T13:28:11Z</dc:date>
    <item>
      <title>coordination of libname statemen</title>
      <link>https://communities.sas.com/t5/SAS-Programming/coordination-of-libname-statemen/m-p/943741#M369863</link>
      <description>&lt;PRE&gt;options mrecall;&lt;BR /&gt;%macro importXLSX(data,data2,getnames);&lt;BR /&gt;options validVarName=any;&lt;BR /&gt;proc import datafile="/home/u50158717/macros/&amp;amp;data..xlsx"&lt;BR /&gt;dbms=xlsx &lt;BR /&gt;out=&amp;amp;data2&lt;BR /&gt;replace;&lt;BR /&gt;getnames=&amp;amp;getnames;&lt;BR /&gt;sheet="Sheet2";&lt;BR /&gt;*datarow=n;&lt;BR /&gt;*range="range name";&lt;BR /&gt;*mixed=yes;&lt;BR /&gt;run; quit;&lt;BR /&gt;%mend importXLSX;&lt;BR /&gt;&lt;BR /&gt;libname ???&lt;BR /&gt;%importXLSX(Sheet2.xlsx,Sheet2.xlsx,getnames=yes);&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Sep 2024 03:06:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/coordination-of-libname-statemen/m-p/943741#M369863</guid>
      <dc:creator>MMSTAT</dc:creator>
      <dc:date>2024-09-13T03:06:16Z</dc:date>
    </item>
    <item>
      <title>Re: coordination of libname statemen</title>
      <link>https://communities.sas.com/t5/SAS-Programming/coordination-of-libname-statemen/m-p/943743#M369865</link>
      <description>&lt;P&gt;As long as you define the libref (libname statement) before you use it you're good to go. With your code this could look like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options dlcreatedir;
libname target "/home/u50158717/results";
%importXLSX(myExcel,target.mySASTable,yes);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Sep 2024 03:17:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/coordination-of-libname-statemen/m-p/943743#M369865</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-09-13T03:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: coordination of libname statemen</title>
      <link>https://communities.sas.com/t5/SAS-Programming/coordination-of-libname-statemen/m-p/943749#M369866</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;libname target "/home/u63984272/macros";&lt;/P&gt;&lt;P&gt;Both the data and this macro are in "/home/u63984272/macros";&lt;/P&gt;&lt;P&gt;where should the libname go?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;70 %macro importXLSX(data,data2,getnames);&lt;BR /&gt;71 options validVarName=any;&lt;BR /&gt;72 proc import datafile="/home/u63984272/macros/&amp;amp;data..xlsx"&lt;BR /&gt;73 dbms=xlsx&lt;BR /&gt;74 out=&amp;amp;data2&lt;BR /&gt;75 replace;&lt;BR /&gt;76 getnames=&amp;amp;getnames;&lt;BR /&gt;77 sheet="Sheet2";&lt;BR /&gt;78 *datarow=n;&lt;BR /&gt;79 *range="range name";&lt;BR /&gt;80 *mixed=yes;&lt;BR /&gt;81 run; quit;&lt;BR /&gt;82 %mend importXLSX;&lt;BR /&gt;83&lt;BR /&gt;84 options dlcreatedir;&lt;BR /&gt;85 libname target "/home/u63984272/macros";&lt;BR /&gt;NOTE: Libref TARGET was successfully assigned as follows:&lt;BR /&gt;Engine: V9&lt;BR /&gt;Physical Name: /home/u63984272/macros&lt;/P&gt;&lt;P&gt;86 %importXLSX(data=sheet2.XLSX,data2=sheet2.XLSX,getnames=yes);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;ERROR: Library name is not assigned.&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Sep 2024 03:56:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/coordination-of-libname-statemen/m-p/943749#M369866</guid>
      <dc:creator>MMSTAT</dc:creator>
      <dc:date>2024-09-13T03:56:52Z</dc:date>
    </item>
    <item>
      <title>Re: coordination of libname statemen</title>
      <link>https://communities.sas.com/t5/SAS-Programming/coordination-of-libname-statemen/m-p/943755#M369867</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/469537"&gt;@MMSTAT&lt;/a&gt;&amp;nbsp;You're passing wrong parameter values to your macro. Compare it with the macro call I've already posted. The 2nd parameter must be the target table name (&amp;lt;libref&amp;gt;.&amp;lt;table name&amp;gt;) and the 3rd parameter may only include the parameter value (yes/no).&lt;/P&gt;</description>
      <pubDate>Fri, 13 Sep 2024 04:32:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/coordination-of-libname-statemen/m-p/943755#M369867</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-09-13T04:32:24Z</dc:date>
    </item>
    <item>
      <title>Re: coordination of libname statemen</title>
      <link>https://communities.sas.com/t5/SAS-Programming/coordination-of-libname-statemen/m-p/943773#M369873</link>
      <description>You supply the parameter data2 as&lt;BR /&gt;sheet2.XLSX. This identifies the dataset as xlsx in the library sheet2.&lt;BR /&gt;If you want to create a dataset sheet2 in the library you defined, you must set&lt;BR /&gt;data2=target.sheet2.</description>
      <pubDate>Fri, 13 Sep 2024 12:28:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/coordination-of-libname-statemen/m-p/943773#M369873</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-09-13T12:28:13Z</dc:date>
    </item>
    <item>
      <title>Re: target is empty?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/coordination-of-libname-statemen/m-p/943794#M369880</link>
      <description>&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 68&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;options mrecall;&lt;/LI&gt;&lt;LI&gt;%macro importXLSX(data,data2,getnames);&lt;/LI&gt;&lt;LI&gt;options validVarName=any;&lt;/LI&gt;&lt;LI&gt;proc import datafile="/home/u63984272/macros/&amp;amp;data..xlsx"&lt;/LI&gt;&lt;LI&gt;dbms=xlsx&lt;/LI&gt;&lt;LI&gt;out=&amp;amp;data2&lt;/LI&gt;&lt;LI&gt;replace;&lt;/LI&gt;&lt;LI&gt;getnames=&amp;amp;getnames;&lt;/LI&gt;&lt;LI&gt;sheet="Sheet2";&lt;/LI&gt;&lt;LI&gt;*datarow=n;&lt;/LI&gt;&lt;LI&gt;*range="range name";&lt;/LI&gt;&lt;LI&gt;*mixed=yes;&lt;/LI&gt;&lt;LI&gt;run; quit;&lt;/LI&gt;&lt;LI&gt;%mend importXLSX; 83&lt;/LI&gt;&lt;LI&gt;options dlcreatedir;&lt;/LI&gt;&lt;LI&gt;libname target "/home/u63984272/macros"; NOTE: Libref TARGET was successfully assigned as follows:&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Engine:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; V9&lt;/P&gt;&lt;P&gt;Physical Name: /home/u63984272/macros&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;%importXLSX(data=sheet2.XLSX,data2=target.sheet2,getnames=yes);&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: Physical file does not exist, /home/u63984272/macros//sheet2.XLSX. NOTE: The SAS System stopped processing this step because of errors.&lt;/P&gt;&lt;P&gt;NOTE: PROCEDURE IMPORT used (Total process time):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;folder target is empty and sheet2.xlsx is only in&amp;nbsp;/home/u63984272/macros//sheet2.XLSX.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Sep 2024 13:28:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/coordination-of-libname-statemen/m-p/943794#M369880</guid>
      <dc:creator>MMSTAT</dc:creator>
      <dc:date>2024-09-13T13:28:11Z</dc:date>
    </item>
    <item>
      <title>Re: target is empty?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/coordination-of-libname-statemen/m-p/943815#M369884</link>
      <description>&lt;P&gt;Please always look very closely at the entire PATH and file names when SAS says something doesn't exist.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your log shows:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;ERROR: Physical file does not exist, /home/u63984272/macros&lt;FONT size="5" color="#FF0000"&gt;&lt;STRONG&gt;//&lt;/STRONG&gt;&lt;/FONT&gt;sheet2.XLSX. NOTE: The SAS System stopped processing this step because of errors.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Note the 2 slashes. Does that match your real file location?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Strong suggestion: Paste code into a text or code box opened by clicking on one of the &amp;lt;/&amp;gt; or "running man" icons above the message window.&lt;/P&gt;
&lt;P&gt;The main message windows on this forum &lt;STRONG&gt;will&lt;/STRONG&gt; reformat pasted text and the bit where your "code" appears with bullet points on each line of the macro indicates that may have happened, possibly obscuring other characters that may be the cause of the error in the file path.&lt;/P&gt;
&lt;P&gt;Similarly, copy text from the LOG and paste it into a text box to prevent the forum from changing the text that actually appeared in the log. The text boxes also help separate the code/log under discussion from the discussion text.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Sep 2024 15:27:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/coordination-of-libname-statemen/m-p/943815#M369884</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-09-13T15:27:29Z</dc:date>
    </item>
    <item>
      <title>Re: coordination of libname statemen</title>
      <link>https://communities.sas.com/t5/SAS-Programming/coordination-of-libname-statemen/m-p/943825#M369886</link>
      <description>&lt;P&gt;So you passed these arguments to the macro (notice how much clearer it is when you pass all of the arguments by name instead of just the last one):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%importXLSX(data=Sheet2.xlsx,data2=Sheet2.xlsx,getnames=yes);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So that will result in this SAS code being generated:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import datafile="/home/u50158717/macros/Sheet2.xlsx.xlsx"
dbms=xlsx 
out=Sheet2.xlsx
replace;
getnames=yes;
sheet="Sheet2";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;Do you really have a file named?&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;"/home/u50158717/macros/Sheet2.xlsx.xlsx"&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;Do you really want to make a SAS dataset named XLSX?&lt;/STRONG&gt;&amp;nbsp; If so then into which directory do you want the PROC IMPORT step to write the xlsx.sas7bdat dataset that will be created ?&amp;nbsp; Once you figure that out then define the SHEET2 libref in the LIBNAME statement before the macro call.&amp;nbsp; Perhaps something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname sheet2 "/home/u50158717/sheet2/";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Sep 2024 16:26:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/coordination-of-libname-statemen/m-p/943825#M369886</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-09-13T16:26:49Z</dc:date>
    </item>
    <item>
      <title>Re: target is empty?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/coordination-of-libname-statemen/m-p/943826#M369887</link>
      <description>&lt;P&gt;I suggest you turn on system option MPRINT, and then review the SAS code that is generated by your macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With this macro code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro importXLSX(data,data2,getnames);
  %put my Excel file is: "/home/u63984272/macros/&amp;amp;data..xlsx" ;
  options validVarName=any;
  proc import datafile="/home/u63984272/macros/&amp;amp;data..xlsx"
    dbms=xlsx
    out=&amp;amp;data2
    replace;
    getnames=&amp;amp;getnames;
    sheet="Sheet2";
  run; quit;
%mend importXLSX;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you call the macro like:&lt;/P&gt;
&lt;PRE&gt;%importXLSX(data=sheet2.XLSX,data2=target.sheet2,getnames=yes)&lt;/PRE&gt;
&lt;P&gt;You will see the macro generates this PROC IMPORT statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import datafile="/home/u63984272/macros/sheet2.XLSX.xlsx" dbms=xlsx out=target.sheet2 replace;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note it is looking for a file named sheet2.XLSX.xlsx.&amp;nbsp; This is likely incorrect. What is the name of the Excel file you are trying to import?&lt;/P&gt;</description>
      <pubDate>Fri, 13 Sep 2024 16:26:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/coordination-of-libname-statemen/m-p/943826#M369887</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2024-09-13T16:26:45Z</dc:date>
    </item>
    <item>
      <title>Re: coordination of libname statemen</title>
      <link>https://communities.sas.com/t5/SAS-Programming/coordination-of-libname-statemen/m-p/943831#M369888</link>
      <description>&lt;P&gt;Why bother to make a macro for such a simple task?&lt;/P&gt;
&lt;P&gt;Point the libref to the folder where you want the SAS datasets to be written.&lt;/P&gt;
&lt;P&gt;The first part of the dataset name is the libref and the second part the dataset names.&lt;/P&gt;
&lt;P&gt;So something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname target "/home/u50158717/datasets/";
proc import
 datafile="/home/u50158717/macros/myfile.xlsx"
 dbms=xlsx replace
 out=target.myfile_sheet2
;
  sheet="Sheet2";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Note: PROC IMPORT does not support using quoted physical names for SAS datasets, even though that syntax works fine in DATA steps and other parts of SAS code.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Sep 2024 17:14:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/coordination-of-libname-statemen/m-p/943831#M369888</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-09-13T17:14:50Z</dc:date>
    </item>
  </channel>
</rss>

