<?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 and sas in Microsoft Integration with SAS</title>
    <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/excel-and-sas/m-p/2432#M130</link>
    <description>James&lt;BR /&gt;
&lt;BR /&gt;
since you are using DDE, you are writing datasteps with infile statements. If your data in these excel workbooks will have consistent structure(column order and informats), you could use one input statement combined with an infile statement like:&lt;BR /&gt;
&lt;BR /&gt;
 infile dumx device= dde filevar= next_trip dsd dlm='09'x lrecl= 10000    ....... ;&lt;BR /&gt;
&lt;BR /&gt;
You just need to ensure that when the infile statement is executed, the variable next_trip will contain the dde triplet through which you next want to read from excel.&lt;BR /&gt;
(and that the workbook is open).&lt;BR /&gt;
&lt;BR /&gt;
Personally, I prefer to insert range names for each set of excel data I want to load, and use libraries for each workbook. &lt;BR /&gt;
&lt;BR /&gt;
libname bk1 'my workbook1.xls' access= readonly ;&lt;BR /&gt;
proc copy in=bk1 out= work mt= data ; run;&lt;BR /&gt;
&lt;BR /&gt;
Although it might appear like more work, it is little more than verifying that each data appears OK.&lt;BR /&gt;
It also removes the need to have data step code to perform the excel open() and close() of the relevant workbooks.&lt;BR /&gt;
&lt;BR /&gt;
But, surely E.G. should relieve you of the need to use DDE ?&lt;BR /&gt;
&lt;BR /&gt;
PeterC</description>
    <pubDate>Mon, 12 Mar 2007 15:26:20 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2007-03-12T15:26:20Z</dc:date>
    <item>
      <title>excel and sas</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/excel-and-sas/m-p/2430#M128</link>
      <description>Hello,&lt;BR /&gt;
&lt;BR /&gt;
I need SAS to look into a directory for a number of excel files, open one at a time, grab data from cells (by dde) and close it and move on.&lt;BR /&gt;
&lt;BR /&gt;
I know how to access one file at a time with DDE triplet but not sure how to automate it with a number of files (macro, maybe?)  also is there a way I can close the file once I'm done extracting?  (ie: x 'abc.xls' to start/open excel, but how do i close it?  I think it will be an issue when I process hundreds of files.)&lt;BR /&gt;
&lt;BR /&gt;
also I would like to use a part of the name of the opened file (eg. 1234565-abc-def.xls - then use '1234565' as a value of the variable 'ID') as a variable in the new dataset - how can I do this??&lt;BR /&gt;
&lt;BR /&gt;
Thank you very much for your support.&lt;BR /&gt;
James</description>
      <pubDate>Wed, 07 Mar 2007 17:05:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/excel-and-sas/m-p/2430#M128</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-03-07T17:05:22Z</dc:date>
    </item>
    <item>
      <title>Re: excel and sas</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/excel-and-sas/m-p/2431#M129</link>
      <description>james,&lt;BR /&gt;
what you describe is very easy. I've been always doing so.&lt;BR /&gt;
to close the excel, you can use DDE to close either workbook or quit excel application. very easy.&lt;BR /&gt;
to loop through all excel files, you can first use pipe to read the file name into a table and then use macro to loop each record in the table.</description>
      <pubDate>Sun, 11 Mar 2007 03:23:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/excel-and-sas/m-p/2431#M129</guid>
      <dc:creator>wensui</dc:creator>
      <dc:date>2007-03-11T03:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: excel and sas</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/excel-and-sas/m-p/2432#M130</link>
      <description>James&lt;BR /&gt;
&lt;BR /&gt;
since you are using DDE, you are writing datasteps with infile statements. If your data in these excel workbooks will have consistent structure(column order and informats), you could use one input statement combined with an infile statement like:&lt;BR /&gt;
&lt;BR /&gt;
 infile dumx device= dde filevar= next_trip dsd dlm='09'x lrecl= 10000    ....... ;&lt;BR /&gt;
&lt;BR /&gt;
You just need to ensure that when the infile statement is executed, the variable next_trip will contain the dde triplet through which you next want to read from excel.&lt;BR /&gt;
(and that the workbook is open).&lt;BR /&gt;
&lt;BR /&gt;
Personally, I prefer to insert range names for each set of excel data I want to load, and use libraries for each workbook. &lt;BR /&gt;
&lt;BR /&gt;
libname bk1 'my workbook1.xls' access= readonly ;&lt;BR /&gt;
proc copy in=bk1 out= work mt= data ; run;&lt;BR /&gt;
&lt;BR /&gt;
Although it might appear like more work, it is little more than verifying that each data appears OK.&lt;BR /&gt;
It also removes the need to have data step code to perform the excel open() and close() of the relevant workbooks.&lt;BR /&gt;
&lt;BR /&gt;
But, surely E.G. should relieve you of the need to use DDE ?&lt;BR /&gt;
&lt;BR /&gt;
PeterC</description>
      <pubDate>Mon, 12 Mar 2007 15:26:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/excel-and-sas/m-p/2432#M130</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-03-12T15:26:20Z</dc:date>
    </item>
  </channel>
</rss>

