<?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: macros in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/macros/m-p/690511#M24736</link>
    <description>&lt;P&gt;It's easier to use a libname for copying over the files in my experience. The select statement is optional, if you do not specify it, all sheets will be copied over.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname mydata excel 'D:\SAS\3. SAS classes clinical\DAY6 7\mydata1.xls';

proc copy in=myData out=work;
select Sheet1 Sheet2;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/327047"&gt;@Naveen1111&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Can someone tell me if i want to import multiple sheets through macros by using loop how can I do that?&lt;/P&gt;
&lt;P&gt;Below is the mentioned program, I tried but working with the same name sheet i.e.(sheet1, sheet2, sheet3, and so on). What if the sheet name in excel is different (navin, pravin, sachin, abc...)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro aml(a=);&lt;BR /&gt;proc import&lt;BR /&gt;datafile="D:\SAS\3. SAS classes clinical\DAY6 7\mydata1.xls"&lt;BR /&gt;out=&amp;amp;a&lt;BR /&gt;DBMS=xls&lt;BR /&gt;replace;&lt;BR /&gt;sheet="&amp;amp;a";&lt;BR /&gt;getnames=yes;&lt;BR /&gt;run;&lt;BR /&gt;%mend aml;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro lop;&lt;BR /&gt;data _null_;&lt;BR /&gt;%do i=1 %to 2;&lt;BR /&gt;%aml(a=sheet&amp;amp;i);&lt;BR /&gt;%end;&lt;BR /&gt;run;&lt;BR /&gt;%mend lop;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks in advance&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Navin Dhawan&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 09 Oct 2020 17:36:41 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2020-10-09T17:36:41Z</dc:date>
    <item>
      <title>macros</title>
      <link>https://communities.sas.com/t5/New-SAS-User/macros/m-p/690507#M24734</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Can someone tell me if i want to import multiple sheets through macros by using loop how can I do that?&lt;/P&gt;&lt;P&gt;Below is the mentioned program, I tried but working with the same name sheet i.e.(sheet1, sheet2, sheet3, and so on). What if the sheet name in excel is different (navin, pravin, sachin, abc...)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro aml(a=);&lt;BR /&gt;proc import&lt;BR /&gt;datafile="D:\SAS\3. SAS classes clinical\DAY6 7\mydata1.xls"&lt;BR /&gt;out=&amp;amp;a&lt;BR /&gt;DBMS=xls&lt;BR /&gt;replace;&lt;BR /&gt;sheet="&amp;amp;a";&lt;BR /&gt;getnames=yes;&lt;BR /&gt;run;&lt;BR /&gt;%mend aml;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro lop;&lt;BR /&gt;data _null_;&lt;BR /&gt;%do i=1 %to 2;&lt;BR /&gt;%aml(a=sheet&amp;amp;i);&lt;BR /&gt;%end;&lt;BR /&gt;run;&lt;BR /&gt;%mend lop;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in advance&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Navin Dhawan&lt;/P&gt;</description>
      <pubDate>Fri, 09 Oct 2020 17:27:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/macros/m-p/690507#M24734</guid>
      <dc:creator>Naveen1111</dc:creator>
      <dc:date>2020-10-09T17:27:58Z</dc:date>
    </item>
    <item>
      <title>Re: macros</title>
      <link>https://communities.sas.com/t5/New-SAS-User/macros/m-p/690511#M24736</link>
      <description>&lt;P&gt;It's easier to use a libname for copying over the files in my experience. The select statement is optional, if you do not specify it, all sheets will be copied over.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname mydata excel 'D:\SAS\3. SAS classes clinical\DAY6 7\mydata1.xls';

proc copy in=myData out=work;
select Sheet1 Sheet2;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/327047"&gt;@Naveen1111&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Can someone tell me if i want to import multiple sheets through macros by using loop how can I do that?&lt;/P&gt;
&lt;P&gt;Below is the mentioned program, I tried but working with the same name sheet i.e.(sheet1, sheet2, sheet3, and so on). What if the sheet name in excel is different (navin, pravin, sachin, abc...)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro aml(a=);&lt;BR /&gt;proc import&lt;BR /&gt;datafile="D:\SAS\3. SAS classes clinical\DAY6 7\mydata1.xls"&lt;BR /&gt;out=&amp;amp;a&lt;BR /&gt;DBMS=xls&lt;BR /&gt;replace;&lt;BR /&gt;sheet="&amp;amp;a";&lt;BR /&gt;getnames=yes;&lt;BR /&gt;run;&lt;BR /&gt;%mend aml;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro lop;&lt;BR /&gt;data _null_;&lt;BR /&gt;%do i=1 %to 2;&lt;BR /&gt;%aml(a=sheet&amp;amp;i);&lt;BR /&gt;%end;&lt;BR /&gt;run;&lt;BR /&gt;%mend lop;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks in advance&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Navin Dhawan&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Oct 2020 17:36:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/macros/m-p/690511#M24736</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-10-09T17:36:41Z</dc:date>
    </item>
    <item>
      <title>Re: macros</title>
      <link>https://communities.sas.com/t5/New-SAS-User/macros/m-p/690523#M24739</link>
      <description>&lt;P&gt;getting an error...Libref MYDATA is not assigned&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: Connect: Class not registered&lt;BR /&gt;ERROR: Error in the LIBNAME statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Oct 2020 17:47:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/macros/m-p/690523#M24739</guid>
      <dc:creator>Naveen1111</dc:creator>
      <dc:date>2020-10-09T17:47:45Z</dc:date>
    </item>
    <item>
      <title>Re: macros</title>
      <link>https://communities.sas.com/t5/New-SAS-User/macros/m-p/690526#M24740</link>
      <description>Try a different engine, ie libname mydata xls 'path to file' &lt;BR /&gt;or PC FILES.</description>
      <pubDate>Fri, 09 Oct 2020 17:50:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/macros/m-p/690526#M24740</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-10-09T17:50:51Z</dc:date>
    </item>
    <item>
      <title>Re: macros</title>
      <link>https://communities.sas.com/t5/New-SAS-User/macros/m-p/690533#M24742</link>
      <description>&lt;P&gt;thanks reeza last time u helped me a lot.&lt;/P&gt;&lt;P&gt;xlsx is the only engine, i tried with xls but getting the same error.&lt;/P&gt;&lt;P&gt;libname gg xlsx "C:\Users\abc\Desktop\SAS\mydata1.xlsx" ;&lt;BR /&gt;proc copy in=gg out=work;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Oct 2020 17:59:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/macros/m-p/690533#M24742</guid>
      <dc:creator>Naveen1111</dc:creator>
      <dc:date>2020-10-09T17:59:11Z</dc:date>
    </item>
    <item>
      <title>Re: macros</title>
      <link>https://communities.sas.com/t5/New-SAS-User/macros/m-p/690536#M24744</link>
      <description>Show a PROC IMPORT code to import the file that works. Whatever is the correct DBMS parameter should also work as a libname statement. &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 09 Oct 2020 18:03:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/macros/m-p/690536#M24744</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-10-09T18:03:01Z</dc:date>
    </item>
    <item>
      <title>Re: macros</title>
      <link>https://communities.sas.com/t5/New-SAS-User/macros/m-p/690549#M24747</link>
      <description>I m sorry it's not working as getting the same error.</description>
      <pubDate>Fri, 09 Oct 2020 18:23:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/macros/m-p/690549#M24747</guid>
      <dc:creator>Naveen1111</dc:creator>
      <dc:date>2020-10-09T18:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: macros</title>
      <link>https://communities.sas.com/t5/New-SAS-User/macros/m-p/690553#M24750</link>
      <description>I would check with your company then if your SAS installation is correct or if you don't have the license to import XLSX files. &lt;BR /&gt;&lt;BR /&gt;It seems like you can't import any Excel files, figure that out first and then you can generalize it to work for all cases.</description>
      <pubDate>Fri, 09 Oct 2020 18:54:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/macros/m-p/690553#M24750</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-10-09T18:54:30Z</dc:date>
    </item>
  </channel>
</rss>

