<?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: excel to sas in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/excel-to-sas/m-p/40158#M8134</link>
    <description>The data step has to be inside the import_xls macro to "see" the value.</description>
    <pubDate>Tue, 02 Jun 2009 18:46:57 GMT</pubDate>
    <dc:creator>Doc_Duke</dc:creator>
    <dc:date>2009-06-02T18:46:57Z</dc:date>
    <item>
      <title>excel to sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/excel-to-sas/m-p/40157#M8133</link>
      <description>%let path=C:\inputfile;&lt;BR /&gt;
%macro import_xls(dat);&lt;BR /&gt;
PROC IMPORT OUT= &amp;amp;dat &lt;BR /&gt;
            DATAFILE= "&amp;amp;path.\may data.xls" &lt;BR /&gt;
            DBMS=EXCEL REPLACE;&lt;BR /&gt;
  	 SHEET="&amp;amp;dat";&lt;BR /&gt;
     GETNAMES=YES;&lt;BR /&gt;
     MIXED=NO;&lt;BR /&gt;
     SCANTEXT=YES;&lt;BR /&gt;
     USEDATE=YES;&lt;BR /&gt;
     SCANTIME=YES;&lt;BR /&gt;
&lt;BR /&gt;
RUN;&lt;BR /&gt;
%mend;&lt;BR /&gt;
%import_xls(ABC_2009_05);&lt;BR /&gt;
%import_xls(pqr_2009_05);&lt;BR /&gt;
&lt;BR /&gt;
I will have data from 16 vendors saved in 16 tabs under may data.xls. I will be creating sas datasets.&lt;BR /&gt;
for each dataset I will have to create two extra fields provider and filedate.&lt;BR /&gt;
for example:&lt;BR /&gt;
 data ABC_2009_05;&lt;BR /&gt;
 set ABC_2009_05;&lt;BR /&gt;
provider='ABC';&lt;BR /&gt;
filedate='2009-05';&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
I tried this piece of code:&lt;BR /&gt;
data &amp;amp;dat;&lt;BR /&gt;
 set &amp;amp;dat;&lt;BR /&gt;
 provider=scan(&amp;amp;dat,1,'_');&lt;BR /&gt;
 filedate=scan(&amp;amp;dat,2,'_')||'-'||scan(&amp;amp;dat,3,'_');&lt;BR /&gt;
 run;&lt;BR /&gt;
&lt;BR /&gt;
But &amp;amp;dat is not getting resolved!</description>
      <pubDate>Tue, 02 Jun 2009 18:44:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/excel-to-sas/m-p/40157#M8133</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2009-06-02T18:44:17Z</dc:date>
    </item>
    <item>
      <title>Re: excel to sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/excel-to-sas/m-p/40158#M8134</link>
      <description>The data step has to be inside the import_xls macro to "see" the value.</description>
      <pubDate>Tue, 02 Jun 2009 18:46:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/excel-to-sas/m-p/40158#M8134</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2009-06-02T18:46:57Z</dc:date>
    </item>
    <item>
      <title>Re: excel to sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/excel-to-sas/m-p/40159#M8135</link>
      <description>Declare &lt;BR /&gt;
 %let dat = ;&lt;BR /&gt;
&lt;BR /&gt;
before calling the macro.&lt;BR /&gt;
i.e. before: &lt;BR /&gt;
  %import_xls(ABC_2009_05);</description>
      <pubDate>Thu, 11 Jun 2009 20:30:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/excel-to-sas/m-p/40159#M8135</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-06-11T20:30:27Z</dc:date>
    </item>
  </channel>
</rss>

