<?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: Export all datasets from a library to single excel file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Export-all-datasets-from-a-library-to-single-excel-file/m-p/699330#M213936</link>
    <description>&lt;P&gt;It might help to include the code along with all the notes, warnings and/or errors generated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Copy the entire procedure step with all the notes from the log and then paste into a code box on the forum opened with the &amp;lt;/&amp;gt; icon to preserve formatting of text and any diagnostic characters.&lt;/P&gt;</description>
    <pubDate>Mon, 16 Nov 2020 22:51:17 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-11-16T22:51:17Z</dc:date>
    <item>
      <title>Export all datasets from a library to single excel file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-all-datasets-from-a-library-to-single-excel-file/m-p/699226#M213887</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The below code is working when I export all datasets into multiple excel file in a specified location but If I want to save all the output in a single excel file with multi-sheet output, where should I change the program. I tried all possible way but its not working.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro SASToExcel(ExportLibrary=);
%* obtain list of datasets in the library;
    ods output members = _Members;
    proc datasets lib = &amp;amp;ExportLibrary; run; quit;
    proc sql;
*get the name of datasets into the list using Dataset1, Dataset2 etc;
        select Name into :Dataset1-
from _Members;
    quit;
*store the number of records to control the loop;
%let NumOfDatasets=&amp;amp;sqlobs;
%*loop to export all your data sets;
    %do index = 1 %to &amp;amp;NumOfDatasets;
		proc export data=&amp;amp;ExportLibrary..&amp;amp;&amp;amp;Dataset&amp;amp;index.
        outfile="/GST/COUNCIL/COUNTRY/Program/&amp;amp;&amp;amp;dataset&amp;amp;index..xlsx"
        dbms=XLS replace;
        run;
    %end;
%mend;
%SASToExcel(ExportLibrary=work);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Nov 2020 16:54:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-all-datasets-from-a-library-to-single-excel-file/m-p/699226#M213887</guid>
      <dc:creator>abraham1</dc:creator>
      <dc:date>2020-11-16T16:54:59Z</dc:date>
    </item>
    <item>
      <title>Re: Export all datasets from a library to single excel file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-all-datasets-from-a-library-to-single-excel-file/m-p/699236#M213893</link>
      <description>&lt;P&gt;This very easy with LIBNAME XLSX:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname outex xlsx "your_excel_file.xlsx";

proc copy in=inlib out=outex;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Nov 2020 17:15:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-all-datasets-from-a-library-to-single-excel-file/m-p/699236#M213893</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-11-16T17:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: Export all datasets from a library to single excel file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-all-datasets-from-a-library-to-single-excel-file/m-p/699242#M213898</link>
      <description>Thank you for the suggestion. As the variable label is more than 50 characters, I am getting warning message as truncation happening during exporting like below. I just wanted to learn how macro work as a newbie. Thanks once again&lt;BR /&gt;&lt;BR /&gt;NOTE: The variable label Employee information in Columbia state of America has been truncated to Employee information</description>
      <pubDate>Mon, 16 Nov 2020 17:31:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-all-datasets-from-a-library-to-single-excel-file/m-p/699242#M213898</guid>
      <dc:creator>abraham1</dc:creator>
      <dc:date>2020-11-16T17:31:17Z</dc:date>
    </item>
    <item>
      <title>Re: Export all datasets from a library to single excel file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-all-datasets-from-a-library-to-single-excel-file/m-p/699245#M213900</link>
      <description>And you really shouldn't be using XLS files anymore. If you need any more reasons for switching off, here's one example. &lt;BR /&gt;&lt;A href="https://www.bbc.com/news/technology-54423988" target="_blank"&gt;https://www.bbc.com/news/technology-54423988&lt;/A&gt;</description>
      <pubDate>Mon, 16 Nov 2020 17:33:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-all-datasets-from-a-library-to-single-excel-file/m-p/699245#M213900</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-11-16T17:33:58Z</dc:date>
    </item>
    <item>
      <title>Re: Export all datasets from a library to single excel file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-all-datasets-from-a-library-to-single-excel-file/m-p/699277#M213917</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/357256"&gt;@abraham1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thank you for the suggestion. As the variable label is more than 50 characters, I am getting warning message as truncation happening during exporting like below. I just wanted to learn how macro work as a newbie. Thanks once again&lt;BR /&gt;&lt;BR /&gt;NOTE: The variable label Employee information in Columbia state of America has been truncated to Employee information&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Not clear why it gives that message. An XLSX file does not have any concept of a variable label.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2020 19:15:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-all-datasets-from-a-library-to-single-excel-file/m-p/699277#M213917</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-11-16T19:15:04Z</dc:date>
    </item>
    <item>
      <title>Re: Export all datasets from a library to single excel file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-all-datasets-from-a-library-to-single-excel-file/m-p/699330#M213936</link>
      <description>&lt;P&gt;It might help to include the code along with all the notes, warnings and/or errors generated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Copy the entire procedure step with all the notes from the log and then paste into a code box on the forum opened with the &amp;lt;/&amp;gt; icon to preserve formatting of text and any diagnostic characters.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2020 22:51:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-all-datasets-from-a-library-to-single-excel-file/m-p/699330#M213936</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-11-16T22:51:17Z</dc:date>
    </item>
  </channel>
</rss>

