<?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: Create different excel sheets by variable in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-different-excel-sheets-by-variable/m-p/520802#M32667</link>
    <description>&lt;P&gt;Sounds like your running out of memory doing the operation.&amp;nbsp; Not really surprising, Excel output is all done in memory.&amp;nbsp; Extend the amount of memory available to SAS.&amp;nbsp; Or, and far better, so not use Excel.&amp;nbsp; 130k observations in a workbook, nobody is ever going to want to look at that, and Excel as a data transfer medium is terrrible.&amp;nbsp; Use CSV, XML or one of the open, cross system compatible, plain text file formats.&amp;nbsp; In fact, unless the recipient actually demands Excel I would avoid it totally.&lt;/P&gt;</description>
    <pubDate>Wed, 12 Dec 2018 13:28:59 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-12-12T13:28:59Z</dc:date>
    <item>
      <title>Create different excel sheets by variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-different-excel-sheets-by-variable/m-p/520736#M32664</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I have to make an excel file with several sheets from a SAS dataset. The dataset contains some variable including USERNAME. I'd like to distribute observations by variable USERNAME. The output xls must contain the mentioned observations: one username for one sheet. The number of the different usernames not constant. The name of the excel sheets must be the username.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried ODS Excel, data step and using macro, but I have no success.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My solution:&amp;nbsp;a macro is called in data step iterations which reads each username.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods excel file="filepath\filename";

%macro create_sheets(username=);
ods excel options(sheet_name="&amp;amp;username");

proc print data HAVE noobs;
where USRNAME="&amp;amp;username";
run;
%mend;

data _NULL_;
set HAVE;

call symput('transfer', strip(USRNAME));
%create_sheets(username=&amp;amp;transfer);
output;
run;

ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This code runs successful but the output excel file contains one sheet with the observations of last username.&lt;/P&gt;&lt;P&gt;I don't know what is the mistake. Please help me.&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2018 10:39:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-different-excel-sheets-by-variable/m-p/520736#M32664</guid>
      <dc:creator>Zax7</dc:creator>
      <dc:date>2018-12-12T10:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: Create different excel sheets by variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-different-excel-sheets-by-variable/m-p/520756#M32665</link>
      <description>&lt;P&gt;There are many examples on here of this.&amp;nbsp; For instance one simple way:&lt;/P&gt;
&lt;PRE&gt;proc sort data=have out=loop nodupkey;
  by usrname;
run;

ods excel file=".../want.xlsx";

data _null_;
  set loop;
  call execute('ods excel options(sheet_name="',strip(usrname),'");');
  call execute('proc report data=have; where usrname="',strip(usrname),'"; run;');
run;

ods excel close;
&lt;/PRE&gt;
&lt;P&gt;This will, from the data null, create one proc report/sheet name for each unique usrname (as found from the original proc sort nodupkey).&lt;/P&gt;
&lt;P&gt;Do avoid using uppercase in your code, we don't need shouting at!&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2018 11:35:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-different-excel-sheets-by-variable/m-p/520756#M32665</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-12-12T11:35:40Z</dc:date>
    </item>
    <item>
      <title>Re: Create different excel sheets by variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-different-excel-sheets-by-variable/m-p/520792#M32666</link>
      <description>&lt;P&gt;Thank you for solution.&lt;/P&gt;&lt;P&gt;But there are some errors: a critical memory shortage occured while extending a crossing table.&lt;/P&gt;&lt;P&gt;The size of the original sas7bdat file is ca. 30MB and contains ca. 130k observations and 35 different username.&lt;/P&gt;&lt;P&gt;The excel workbook conatins only 17 sheets however these are perfect.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2018 13:12:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-different-excel-sheets-by-variable/m-p/520792#M32666</guid>
      <dc:creator>Zax7</dc:creator>
      <dc:date>2018-12-12T13:12:41Z</dc:date>
    </item>
    <item>
      <title>Re: Create different excel sheets by variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-different-excel-sheets-by-variable/m-p/520802#M32667</link>
      <description>&lt;P&gt;Sounds like your running out of memory doing the operation.&amp;nbsp; Not really surprising, Excel output is all done in memory.&amp;nbsp; Extend the amount of memory available to SAS.&amp;nbsp; Or, and far better, so not use Excel.&amp;nbsp; 130k observations in a workbook, nobody is ever going to want to look at that, and Excel as a data transfer medium is terrrible.&amp;nbsp; Use CSV, XML or one of the open, cross system compatible, plain text file formats.&amp;nbsp; In fact, unless the recipient actually demands Excel I would avoid it totally.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2018 13:28:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-different-excel-sheets-by-variable/m-p/520802#M32667</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-12-12T13:28:59Z</dc:date>
    </item>
    <item>
      <title>Re: Create different excel sheets by variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-different-excel-sheets-by-variable/m-p/520837#M32668</link>
      <description>&lt;P&gt;Yes, I'm running out of memory.&lt;/P&gt;&lt;P&gt;I have&amp;nbsp;added the -memsize max option to sasv9.cfg.&lt;/P&gt;&lt;P&gt;After this the process ran successfully.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you again.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2018 15:00:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-different-excel-sheets-by-variable/m-p/520837#M32668</guid>
      <dc:creator>Zax7</dc:creator>
      <dc:date>2018-12-12T15:00:34Z</dc:date>
    </item>
    <item>
      <title>Re: Create different excel sheets by variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-different-excel-sheets-by-variable/m-p/521917#M32688</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;The option sheet_interval="table" should be added to get the tables on the different sheets.&lt;BR /&gt;Unfortunately I don’t no the solution for the other problem – name of sheets&lt;BR /&gt;&lt;BR /&gt;Kind regards&lt;BR /&gt;&lt;BR /&gt;Natalja&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 17 Dec 2018 14:15:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-different-excel-sheets-by-variable/m-p/521917#M32688</guid>
      <dc:creator>NataljaK</dc:creator>
      <dc:date>2018-12-17T14:15:47Z</dc:date>
    </item>
  </channel>
</rss>

