<?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 &amp; proc report in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Excel-proc-report/m-p/13707#M1651</link>
    <description>When I run the code and try to open temp.xls,it gives a message "file in use".</description>
    <pubDate>Mon, 11 Oct 2010 13:57:48 GMT</pubDate>
    <dc:creator>SASPhile</dc:creator>
    <dc:date>2010-10-11T13:57:48Z</dc:date>
    <item>
      <title>Excel &amp; proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excel-proc-report/m-p/13695#M1639</link>
      <description>If there is a leading zero for zip code or phyid,it is getting dropped in excel.I'm using ods and proc report.How to retain the format of the variables as they are in SAS dataset when exported to excel.</description>
      <pubDate>Thu, 07 Oct 2010 17:39:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excel-proc-report/m-p/13695#M1639</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2010-10-07T17:39:14Z</dc:date>
    </item>
    <item>
      <title>Re: Excel &amp; proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excel-proc-report/m-p/13696#M1640</link>
      <description>Suggest searching the SAS forums and the support website - the topic has been addressed before.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
Suggested Google advanced search argument, this topic / post:&lt;BR /&gt;
&lt;BR /&gt;
leading zero zip code export excel site:sas.com</description>
      <pubDate>Thu, 07 Oct 2010 17:44:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excel-proc-report/m-p/13696#M1640</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-10-07T17:44:11Z</dc:date>
    </item>
    <item>
      <title>Re: Excel &amp; proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excel-proc-report/m-p/13697#M1641</link>
      <description>Hi:&lt;BR /&gt;
  Depending on how you are getting your results into Excel (ODS HTML, ODS CSV or ODS TAGSETS.EXCELXP or DDE or PROC EXPORT) you may or may not be able to get Excel to show leading zeroes. For ODS HTML and ODS TAGSETS.EXCELXP -- this is very do-able using HTMLSTYLE or TAGATTR style attributes.&lt;BR /&gt;
&lt;BR /&gt;
  As Scott suggests, searching previous forum postings may help you out here.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Thu, 07 Oct 2010 21:14:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excel-proc-report/m-p/13697#M1641</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-10-07T21:14:56Z</dc:date>
    </item>
    <item>
      <title>Re: Excel &amp; proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excel-proc-report/m-p/13698#M1642</link>
      <description>Frankly, I would say that it more depends on zip-plus-4 sometimes being encountered in the GUESSINGROWS data-window, which tends to create a real pickle.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Thu, 07 Oct 2010 23:56:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excel-proc-report/m-p/13698#M1642</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-10-07T23:56:34Z</dc:date>
    </item>
    <item>
      <title>Re: Excel &amp; proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excel-proc-report/m-p/13699#M1643</link>
      <description>Leading zeroes and Excel are just an issue in general, whether you're talking about IMPORT (Excel to SAS dataset) or EXPORT (SAS dataset to Excel) or ODS (SAS output to Excel). At least with some ODS methods, even if Excel won't respect the SAS format, you DO have a chance to send the Microsoft format from SAS to Excel.&lt;BR /&gt;
&lt;BR /&gt;
Since the OP did not say HOW he was using ODS (CSV, HTML, MSOFFICE2K, TAGSETS.EXCELXP), it's hard to respond in more detaiil. But your idea to search the forum was a good one. I know that I've posted the leading zero solution a couple of times. And I know that it's been in several papers by the folks in Tech Support and others.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Fri, 08 Oct 2010 00:59:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excel-proc-report/m-p/13699#M1643</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-10-08T00:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: Excel &amp; proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excel-proc-report/m-p/13700#M1644</link>
      <description>This is a good fix for leading zeros issue in when exporting to excel using proc report ODS.&lt;BR /&gt;
&lt;BR /&gt;
define zip1 / group '5 digit zip'&lt;BR /&gt;
       STYLE (header) = {just=left  font_size=1}&lt;BR /&gt;
       STYLE (COLUMN) = {htmlstyle="mso-number-format:\@" just=left  font_size=1.5};</description>
      <pubDate>Fri, 08 Oct 2010 13:36:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excel-proc-report/m-p/13700#M1644</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2010-10-08T13:36:01Z</dc:date>
    </item>
    <item>
      <title>Re: Excel &amp; proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excel-proc-report/m-p/13701#M1645</link>
      <description>Yes, that's exactly the example. It is not specific to PROC REPORT, however. The Microsoft format technique will work with PROC REPORT, PROC PRINT, PROC TABULATE, and in a TABLE template or a STYLE template. The syntax you show is the PROC REPORT syntax, but similar syntax (not exactly the same) will work with other procedures. For example, the PROC PRINT equivalent is shown here:&lt;BR /&gt;
&lt;A href="http://support.sas.com/kb/32/414.html" target="_blank"&gt;http://support.sas.com/kb/32/414.html&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
In your example, the @ tells Excel that you want the number with leading zeroes to be treated as a text string. If you wanted to have a numeric value display leading zeroes, but remain numeric, then you would do:&lt;BR /&gt;
[pre]&lt;BR /&gt;
STYLE (COLUMN) = {htmlstyle="mso-number-format:00000"}; &lt;BR /&gt;
[/pre]&lt;BR /&gt;
          &lt;BR /&gt;
 But the HTMLSTYLE approach will only work for HTML-based ODS destinations (ODS HTML, ODS MSOFFICE2K, ODS HTMLCSS, etc). &lt;BR /&gt;
&lt;BR /&gt;
When you use ODS to create files for Excel to open and render, you are not creating true, binary Excel files -- such as you would create with PROC EXPORT or the Excel LIBNAME engine. ODS is only creating ASCII text files that Excel knows how to open and render. So the instructions that you send for a Microsoft format must be in either an HTML (mso-number-format) or an XML specification.&lt;BR /&gt;
       &lt;BR /&gt;
HTML and XML are file types that are openable with Excel -- but they are not "true" .xls or .xlsb files. So, if you name your ODS file with a .XLS extension, Excel will grumble a bit before opening the file in Office 2007 and 2010 with the warning:&lt;B&gt;&lt;BR /&gt;
The file you are trying to open, '[filename]', is in a different format than&lt;BR /&gt;
specified by the file extension. Verify that the file is not corrupted and is&lt;BR /&gt;
from a trusted source before opening the file. Do you want to open the file&lt;BR /&gt;
now?&lt;/B&gt;&lt;BR /&gt;
       &lt;BR /&gt;
Microsoft's thinking behind the warning are described here:&lt;BR /&gt;
&lt;A href="http://blogs.msdn.com/b/vsofficedeveloper/archive/2008/03/11/excel-2007-extension-warning.aspx" target="_blank"&gt;http://blogs.msdn.com/b/vsofficedeveloper/archive/2008/03/11/excel-2007-extension-warning.aspx&lt;/A&gt;&lt;BR /&gt;
                   &lt;BR /&gt;
So given that you are creating HTML tags with ODS HTML or MSOFFICE2K, the HTMLSTYLE puts a Microsoft format style property (mso-number-format) into the HTML tags being generated so that when the file is rendered by Excel -- it has the instructions for spreadsheet formatting.&lt;BR /&gt;
&lt;BR /&gt;
TAGSETS.EXCELXP does use a Microsoft format, but via a different mechanism on the SAS side because the XML tags required for Spreadsheet Markup Language XML follow a different form than the HTML. So if you were going to want leading zeroes respected with ODS TAGSETS.EXCELXP, you would do:&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
STYLE (COLUMN) = {tagattr="Format:@"}; &lt;BR /&gt;
OR&lt;BR /&gt;
STYLE (COLUMN) = {tagattr="Format:00000"}; &lt;BR /&gt;
[/pre]&lt;BR /&gt;
            &lt;BR /&gt;
Some other useful Microsoft formats are listed on page 2 of this paper:&lt;BR /&gt;
 &lt;A href="http://www2.sas.com/proceedings/sugi28/012-28.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi28/012-28.pdf&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
cynthia</description>
      <pubDate>Fri, 08 Oct 2010 15:40:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excel-proc-report/m-p/13701#M1645</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-10-08T15:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: Excel &amp; proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excel-proc-report/m-p/13702#M1646</link>
      <description>Thats true.But so far i'm not sucessful in using TAGSETS.EXCELXP .Thats the reason I resort to HTML-based ODS destinations.</description>
      <pubDate>Fri, 08 Oct 2010 16:30:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excel-proc-report/m-p/13702#M1646</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2010-10-08T16:30:00Z</dc:date>
    </item>
    <item>
      <title>Re: Excel &amp; proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excel-proc-report/m-p/13703#M1647</link>
      <description>Sorry to hear that (not successful with TAGSETS.EXCELXP). Both of the programs below work for me.&lt;BR /&gt;
&lt;BR /&gt;
The only thing that I can think of not working in TAGSETS.EXCELXP is using SAS/GRAPH programs, since it is MICROSOFT that did not allow graphic images in the Spreadsheet Markup Language XML.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
data phid;&lt;BR /&gt;
  length name address $15;&lt;BR /&gt;
  infile datalines;&lt;BR /&gt;
  input phid name $  zip $ qty;&lt;BR /&gt;
return;&lt;BR /&gt;
datalines;&lt;BR /&gt;
1001 John 10103 25&lt;BR /&gt;
1002 Adams 00123 30&lt;BR /&gt;
1002 Adams 02001 30&lt;BR /&gt;
1003 Mark 28546 30&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
                      &lt;BR /&gt;
title; footnote;&lt;BR /&gt;
           &lt;BR /&gt;
ods listing close;&lt;BR /&gt;
ods msoffice2k file='c:\temp\use_MS_format_ht.xls' style=sasweb;&lt;BR /&gt;
                &lt;BR /&gt;
proc report data=phid nowd;&lt;BR /&gt;
  title '2)  Use HTMLSTYLE to send a MICROSOFT format to Excel';&lt;BR /&gt;
  column phid name zip qty;&lt;BR /&gt;
  define phid / display &lt;BR /&gt;
         style(column)={htmlstyle="mso-number-format:000000"};&lt;BR /&gt;
  define name /display;&lt;BR /&gt;
  define zip / display&lt;BR /&gt;
         style(column)={htmlstyle="mso-number-format:00000"};&lt;BR /&gt;
  define qty / sum;&lt;BR /&gt;
run;&lt;BR /&gt;
                  &lt;BR /&gt;
ods _all_ close;&lt;BR /&gt;
&lt;BR /&gt;
                  &lt;BR /&gt;
ods listing close;&lt;BR /&gt;
ods tagsets.excelxp file='c:\temp\use_MS_format_xp.xls' &lt;BR /&gt;
    style=sasweb options(doc='Help');&lt;BR /&gt;
               &lt;BR /&gt;
proc report data=phid nowd;&lt;BR /&gt;
  title '3)  Use TAGATTR to send a MICROSOFT format to Excel';&lt;BR /&gt;
  column phid name zip qty;&lt;BR /&gt;
  define phid / display &lt;BR /&gt;
         style(column)={tagattr="Format:000000"};&lt;BR /&gt;
  define name /display;&lt;BR /&gt;
  define zip / display &lt;BR /&gt;
         style(column)={tagattr="Format:00000"};&lt;BR /&gt;
  define qty / sum;&lt;BR /&gt;
run; &lt;BR /&gt;
                   &lt;BR /&gt;
ods _all_ close;&lt;BR /&gt;
               &lt;BR /&gt;
title;&lt;BR /&gt;
&lt;BR /&gt;
[/pre]</description>
      <pubDate>Fri, 08 Oct 2010 19:26:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excel-proc-report/m-p/13703#M1647</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-10-08T19:26:23Z</dc:date>
    </item>
    <item>
      <title>Re: Excel &amp; proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excel-proc-report/m-p/13704#M1648</link>
      <description>When TAGSETS.EXCELXP is used it supresses the gridlines in excel.</description>
      <pubDate>Fri, 08 Oct 2010 20:16:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excel-proc-report/m-p/13704#M1648</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2010-10-08T20:16:02Z</dc:date>
    </item>
    <item>
      <title>Re: Excel &amp; proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excel-proc-report/m-p/13705#M1649</link>
      <description>Oh, that's odd. When I run the code, my table does have interior grid lines. The rest of the area outside my table does not have grid lines, but that's in sync with how the output looks in Print Preview.&lt;BR /&gt;
&lt;BR /&gt;
cynthia</description>
      <pubDate>Fri, 08 Oct 2010 20:35:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excel-proc-report/m-p/13705#M1649</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-10-08T20:35:41Z</dc:date>
    </item>
    <item>
      <title>Re: Excel &amp; proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excel-proc-report/m-p/13706#M1650</link>
      <description>Also, searching on support.sas.com finds this Tech Support note that explains how a style template can allow you to see the gridlines when you use TAGSETS.EXCELXP.&lt;BR /&gt;
&lt;A href="http://support.sas.com/kb/38/282.html" target="_blank"&gt;http://support.sas.com/kb/38/282.html&lt;/A&gt;&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Sat, 09 Oct 2010 02:37:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excel-proc-report/m-p/13706#M1650</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-10-09T02:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: Excel &amp; proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excel-proc-report/m-p/13707#M1651</link>
      <description>When I run the code and try to open temp.xls,it gives a message "file in use".</description>
      <pubDate>Mon, 11 Oct 2010 13:57:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excel-proc-report/m-p/13707#M1651</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2010-10-11T13:57:48Z</dc:date>
    </item>
    <item>
      <title>Re: Excel &amp; proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excel-proc-report/m-p/13708#M1652</link>
      <description>At this point, you will need to share your code, preferably as it appears in a SAS log output with all code revealed.  Likely you have an open FILENAME or ODS, if your SAS session is still active when you attempt to open the XLS file -- it's unclear whether you get an Excel error or a SAS error, as explained?&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Mon, 11 Oct 2010 14:57:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excel-proc-report/m-p/13708#M1652</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-10-11T14:57:59Z</dc:date>
    </item>
  </channel>
</rss>

