<?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: Blank Sheet/Workbook using ODS Excel in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Blank-Sheet-Workbook-using-ODS-Excel/m-p/277014#M16065</link>
    <description>&lt;P&gt;You're right on the money, I'm running 9.4 SP 2.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have however written a work around that actually solves a secondary problem with blank sheets.&amp;nbsp; First, when you use a blank sheet, the sheet created doesn't even contain headers to show what columns should be there.&amp;nbsp; The code I've put together may not be the most elegant, but it is effective.&amp;nbsp; This code reads in the metadata of an empty table into a single row of a new table with mock column names.&amp;nbsp; Using Proc Report, I hide the headers tricking the ODS into outputing a single row with the true header names.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* READ METADATA INFORMATION OF DATASET INTO ANOTHER DATASET */

PROC CONTENTS DATA = SASHELP.CLASS
   OUT = WORK.CLSCONTENT;
RUN;

/* DEFINE HOW MANY COLUMNS EXIST IN THE DATASET */

PROC SQL NOPRINT;
   SELECT MAX(VARNUM) INTO: TTLCOL FROM WORK.CLSCONTENT;
QUIT;

DATA _NULL_;
   CALL SYMPUTX('TTLCOLS', 'C' || STRIP(&amp;amp;TTLCOL.));
RUN;

/* CREATES A NEW TABLE BREAKING OUT EACH COLUMN TO BE A VARIABLE (FOR OUTPUT)
                                       RATHER THAN BEING A COLUMN NAME ITSELF */

DATA WORK.TRANSP;
   SET CLSCONTENT(KEEP=NAME VARNUM);
   RETAIN C1 - &amp;amp;TTLCOLS.;
   ARRAY COL[*] $ C1 - &amp;amp;TTLCOLS.;
   DO I=1 TO DIM(COL);
      IF VARNUM = I THEN COL[I] = NAME;
   END;
      IF &amp;amp;TTLCOLS. = '' THEN DELETE;
   DROP NAME VARNUM I;
RUN;

/* OUTPUT TABLE USING PROC REPORT WITH NOHEADER TO HIDE THE TRUE HEADER VALUES */

ODS EXCEL
   FILE='/workspace/data/blnksheet.xlsx'
   OPTIONS(SHEET_NAME='TEST-VAL' ABSOLUTE_COLUMN_WIDTH='30');
      PROC REPORT DATA = WORK.TRANSP NOHEADER;
      RUN;
   QUIT;
ODS EXCEL CLOSE;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 13 Jun 2016 18:11:32 GMT</pubDate>
    <dc:creator>WilliamD_</dc:creator>
    <dc:date>2016-06-13T18:11:32Z</dc:date>
    <item>
      <title>Blank Sheet/Workbook using ODS Excel</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Blank-Sheet-Workbook-using-ODS-Excel/m-p/276316#M16031</link>
      <description>&lt;P&gt;Hi, I'm wondering if anyone else has attempted to use ODS EXCEL OPTION(Blank_Sheet='example_sheet') and been able to create a working work book?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My team and I have recently upgraded our server from an older UNIX machine running 9.2 to a Linux SAS Grid running 9.4.&amp;nbsp; I have successfully migrated all of my ODS TAGSETS.EXCELXP code to output to the new ODS EXCEL outputs into xlsx which is far superior than the xml files I previously had to generate.&amp;nbsp; However, I'm finding that while the SAS Support page shows the option to use BLANK_SHEET is there, all attempts to utilize this option have resulted in a file that excel thinks is corrupt.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's an example script:&lt;BR /&gt;ODS EXCEL&lt;BR /&gt;&amp;nbsp;&amp;nbsp; FILE='/users/data/example.xlsx'&lt;BR /&gt;&amp;nbsp;&amp;nbsp; STYLE = STATISTICAL&lt;BR /&gt;&amp;nbsp;&amp;nbsp; OPTIONS(BLANK_SHEET = 'TEST');&lt;BR /&gt;QUIT;&lt;BR /&gt;ODS EXCEL CLOSE;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've also tried inserting a PROC PRINT query to output a dataset with zero obs which produces the same corrupt file.&amp;nbsp; Last, I actually attempted to make a multi-worksheet workbook with one table that has obs and the second without.&amp;nbsp; This file does open however, the second sheet with zero obs does not exist in the file output (the workbook only shows the sheet with obs).&amp;nbsp; I am using MS Office Excel 2010 to try and open these files.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would greatly appreciate any feedback from the community on if others have experienced this and what work-arounds were used, will I be forced to continue to use the ODS TAGSETS.EXCELXP for my blank workbooks? Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2016 17:04:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Blank-Sheet-Workbook-using-ODS-Excel/m-p/276316#M16031</guid>
      <dc:creator>WilliamD_</dc:creator>
      <dc:date>2016-06-09T17:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: Blank Sheet/Workbook using ODS Excel</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Blank-Sheet-Workbook-using-ODS-Excel/m-p/276718#M16052</link>
      <description>&lt;P&gt;Which maintenance release of SAS 9.4 are you using?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is the code that I tried in SAS 9.4 maintenance release 2:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
ODS EXCEL FILE="H:\CenSAS stuff\ODS Excel examples\blank worksheet.xlsx"
  STYLE=Statistical
  options(blank_sheet='Test');

ODS EXCEL CLOSE;

ODS EXCEL FILE="H:\CenSAS stuff\ODS Excel examples\blank worksheet at beginning.xlsx"
  STYLE=Statistical
  options(blank_sheet='Test');

ODS EXCEL options(sheet_name='SASHELP.CLASS');

proc print data=sashelp.class;
run;

ODS EXCEL CLOSE;


ODS EXCEL FILE="H:\CenSAS stuff\ODS Excel examples\blank worksheet at end.xlsx"
  STYLE=Statistical
  options(sheet_name='SASHELP.CLASS');

proc print data=sashelp.class;
run;

ODS EXCEL options(blank_sheet='Test');

ODS EXCEL CLOSE;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The first file, just a blank worksheet, won't open. &amp;nbsp;I get the message about the file being corrupt.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The second file, with a blank worksheet, followed by the sheet with the SASHELP.CLASS data set, opens. &amp;nbsp;The first sheet is blank.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The third file, with the SASHELP.class data set on the first sheet, followed by a blank worksheet, opens. &amp;nbsp;However, there's just the first worksheet in the file. &amp;nbsp;The blank worksheet was not created.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried the same code in SAS 9.4 maintenance release 3, and all files were created as expected. &amp;nbsp;The ODS Excel destination is experimental in SAS 9.4 maintenance releases 1 and 2.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Jun 2016 22:19:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Blank-Sheet-Workbook-using-ODS-Excel/m-p/276718#M16052</guid>
      <dc:creator>SuzanneDorinski</dc:creator>
      <dc:date>2016-06-11T22:19:51Z</dc:date>
    </item>
    <item>
      <title>Re: Blank Sheet/Workbook using ODS Excel</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Blank-Sheet-Workbook-using-ODS-Excel/m-p/277014#M16065</link>
      <description>&lt;P&gt;You're right on the money, I'm running 9.4 SP 2.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have however written a work around that actually solves a secondary problem with blank sheets.&amp;nbsp; First, when you use a blank sheet, the sheet created doesn't even contain headers to show what columns should be there.&amp;nbsp; The code I've put together may not be the most elegant, but it is effective.&amp;nbsp; This code reads in the metadata of an empty table into a single row of a new table with mock column names.&amp;nbsp; Using Proc Report, I hide the headers tricking the ODS into outputing a single row with the true header names.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* READ METADATA INFORMATION OF DATASET INTO ANOTHER DATASET */

PROC CONTENTS DATA = SASHELP.CLASS
   OUT = WORK.CLSCONTENT;
RUN;

/* DEFINE HOW MANY COLUMNS EXIST IN THE DATASET */

PROC SQL NOPRINT;
   SELECT MAX(VARNUM) INTO: TTLCOL FROM WORK.CLSCONTENT;
QUIT;

DATA _NULL_;
   CALL SYMPUTX('TTLCOLS', 'C' || STRIP(&amp;amp;TTLCOL.));
RUN;

/* CREATES A NEW TABLE BREAKING OUT EACH COLUMN TO BE A VARIABLE (FOR OUTPUT)
                                       RATHER THAN BEING A COLUMN NAME ITSELF */

DATA WORK.TRANSP;
   SET CLSCONTENT(KEEP=NAME VARNUM);
   RETAIN C1 - &amp;amp;TTLCOLS.;
   ARRAY COL[*] $ C1 - &amp;amp;TTLCOLS.;
   DO I=1 TO DIM(COL);
      IF VARNUM = I THEN COL[I] = NAME;
   END;
      IF &amp;amp;TTLCOLS. = '' THEN DELETE;
   DROP NAME VARNUM I;
RUN;

/* OUTPUT TABLE USING PROC REPORT WITH NOHEADER TO HIDE THE TRUE HEADER VALUES */

ODS EXCEL
   FILE='/workspace/data/blnksheet.xlsx'
   OPTIONS(SHEET_NAME='TEST-VAL' ABSOLUTE_COLUMN_WIDTH='30');
      PROC REPORT DATA = WORK.TRANSP NOHEADER;
      RUN;
   QUIT;
ODS EXCEL CLOSE;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Jun 2016 18:11:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Blank-Sheet-Workbook-using-ODS-Excel/m-p/277014#M16065</guid>
      <dc:creator>WilliamD_</dc:creator>
      <dc:date>2016-06-13T18:11:32Z</dc:date>
    </item>
  </channel>
</rss>

