<?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: Losing formats using an ODS to Excel in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Losing-formats-using-an-ODS-to-Excel/m-p/177054#M12575</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you, Cynthia. Sadly, I still work on SAS 9.2 and I noticed the original post used the ODS Excel destination but I couldn't find anything in the documentation about TAGATTR and ODS Excel, although I didn't look that hard, but I did recently have a conversation with Chevell Parker and he had mentioned the new functionality for the forthcoming 9.4M4 release.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;M.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 13 Jan 2015 14:48:28 GMT</pubDate>
    <dc:creator>MaikH_Schutze</dc:creator>
    <dc:date>2015-01-13T14:48:28Z</dc:date>
    <item>
      <title>Losing formats using an ODS to Excel</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Losing-formats-using-an-ODS-to-Excel/m-p/177047#M12568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f8f8f8;"&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f8f8f8;"&gt;Hoping to find some help with the following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f8f8f8;"&gt;data x;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f8f8f8;"&gt;set y;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f8f8f8;"&gt;SNum=(put(input(SNum,6.),Z6.));&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f8f8f8;"&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f8f8f8;"&gt;ods excel file="path.xls";&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f8f8f8;"&gt;proc print data=x label noobs;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f8f8f8;"&gt;format DVisit date.;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f8f8f8;"&gt;run;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f8f8f8;"&gt;ods excel close;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f8f8f8;"&gt;When I run the code, SAS in the Output window shows the six digit "SNum", but when it's exported to Excel "SNum" is no longer padded to 6 digits. What gives?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f8f8f8;"&gt;When I try to format the SNum in the PROC PRINT step, SAS gives me the following error:&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f8f8f8;"&gt;ERROR: You are trying to use the numeric format Z with the character variable SNum in data set WORK.X.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f8f8f8;"&gt;I thought by having this in the DATA step, the format becomes permanent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f8f8f8;"&gt;How do I fix this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f8f8f8;"&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 10 Jan 2015 01:17:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Losing-formats-using-an-ODS-to-Excel/m-p/177047#M12568</guid>
      <dc:creator>dereck255</dc:creator>
      <dc:date>2015-01-10T01:17:28Z</dc:date>
    </item>
    <item>
      <title>Re: Losing formats using an ODS to Excel</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Losing-formats-using-an-ODS-to-Excel/m-p/177048#M12569</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Open a brand-new Excel spreadsheet and in any cell type in the numbers 000111, then press enter. What you will see is not 000111 but just 111. This is the default Excel behaviour. This is exactly what Excel is doing when you open your spreadsheet created from PROC PRINT. It&amp;nbsp; does not matter if your SAS column is numeric or character or what SAS format you apply you will get the same result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To fix the problem you have provide Excel with some further formatting instructions to avoid the default behaviour.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try adding the following VAR statement to your PROC PRINT:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;var snum / style(column)={TAGATTR="Format:000000"};&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 10 Jan 2015 04:27:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Losing-formats-using-an-ODS-to-Excel/m-p/177048#M12569</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2015-01-10T04:27:48Z</dc:date>
    </item>
    <item>
      <title>Re: Losing formats using an ODS to Excel</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Losing-formats-using-an-ODS-to-Excel/m-p/177049#M12570</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your reply, though It didn't work. Instead, I got a second column labeled "snum" with the same unpadded digits. Any other ideas?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Jan 2015 17:45:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Losing-formats-using-an-ODS-to-Excel/m-p/177049#M12570</guid>
      <dc:creator>dereck255</dc:creator>
      <dc:date>2015-01-12T17:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: Losing formats using an ODS to Excel</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Losing-formats-using-an-ODS-to-Excel/m-p/177050#M12571</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What version of SAS are you using? There is a pre-prodution tagset in 9.4 that should automatically convert SAS formats to Excel formats without the TAGATTR= option.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And maybe I don't understand what you are trying to do. It looks like you are explcitily converting a character field to a numeric field with the w.d format - input(SNum,6.) - and then do another explicit conversion back to character using Zw.d function in the PUT statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does your the original value for SNum already have leading zeroes? Maybe a few lines are data would help so we can test the logic.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Jan 2015 18:33:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Losing-formats-using-an-ODS-to-Excel/m-p/177050#M12571</guid>
      <dc:creator>MaikH_Schutze</dc:creator>
      <dc:date>2015-01-12T18:33:01Z</dc:date>
    </item>
    <item>
      <title>Re: Losing formats using an ODS to Excel</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Losing-formats-using-an-ODS-to-Excel/m-p/177051#M12572</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try: &lt;SPAN style="font-family: 'Calibri','sans-serif'; font-size: 11pt;"&gt;var snum / style(column)={TAGATTR="Format:@"};&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Jan 2015 18:49:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Losing-formats-using-an-ODS-to-Excel/m-p/177051#M12572</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2015-01-12T18:49:50Z</dc:date>
    </item>
    <item>
      <title>Re: Losing formats using an ODS to Excel</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Losing-formats-using-an-ODS-to-Excel/m-p/177052#M12573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi: TAGATTR will only work with TAGSETS.EXCELXP. I do not believe it works with ODS EXCEL. The original post showed ODS EXCEL. I understand that by later versions of SAS 9.4 (not M0), the SAS formats (such as Z6.) would be automatically used by ODS EXCEL. But the original post did not indicate the version of SAS or whether ODS EXCEL was a typo or whether he meant ODS TAGSETS.EXCELXP. So if he did mean the new ODS EXCEL, then he should be able to use the format directly without creating the dataset at all. The code shown in the attached screen shots was run by someone in Tech Support who had access to multiple versions of SAS 9.4 and even though there are minor differences, the pictures show the Z format being used, without the need for a DATA step program and explicit conversion.&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/10623i952F41CAEB701614/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="code_for_new_M1_xlsx.png" title="code_for_new_M1_xlsx.png" /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/10624i44908E2B275FEE92/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="code_for_new_xlsx.png" title="code_for_new_xlsx.png" /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/10625i8E05664E070283C7/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="pic_of_new_m1_xlsx.png" title="pic_of_new_m1_xlsx.png" /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/10626iA9F091F1AD92C603/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="pic_of_new_xlsx.png" title="pic_of_new_xlsx.png" /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jan 2015 00:03:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Losing-formats-using-an-ODS-to-Excel/m-p/177052#M12573</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2015-01-13T00:03:54Z</dc:date>
    </item>
    <item>
      <title>Re: Losing formats using an ODS to Excel</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Losing-formats-using-an-ODS-to-Excel/m-p/177053#M12574</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oops. Cynthia is quite correct. I should have looked more closely at the original post... &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jan 2015 03:59:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Losing-formats-using-an-ODS-to-Excel/m-p/177053#M12574</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2015-01-13T03:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: Losing formats using an ODS to Excel</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Losing-formats-using-an-ODS-to-Excel/m-p/177054#M12575</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you, Cynthia. Sadly, I still work on SAS 9.2 and I noticed the original post used the ODS Excel destination but I couldn't find anything in the documentation about TAGATTR and ODS Excel, although I didn't look that hard, but I did recently have a conversation with Chevell Parker and he had mentioned the new functionality for the forthcoming 9.4M4 release.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;M.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jan 2015 14:48:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Losing-formats-using-an-ODS-to-Excel/m-p/177054#M12575</guid>
      <dc:creator>MaikH_Schutze</dc:creator>
      <dc:date>2015-01-13T14:48:28Z</dc:date>
    </item>
    <item>
      <title>Re: Losing formats using an ODS to Excel</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Losing-formats-using-an-ODS-to-Excel/m-p/177055#M12576</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;&amp;nbsp; TAGATTR style override method of passing a Microsoft format to Excel was explicitly designed for use with the TAGSETS.EXCELXP destination, which creates a Spreadsheet Markup Language XML file that Excel knows how to open and render. This is entirely a different kind of file than the XLSX zip archive file created by the new (SAS 9.4) ODS Excel. Many of the format issues that required the use of TAGATTR with TAGSETS.EXCELXP will not be an issue with ODS EXCEL. Since the original posting showed ODS EXCEL, then I wanted to clarify that if the original post was indeed about ODS EXCEL in SAS 9.4, then a conversion to get leading zeroes should not be necessary (as shown in the screen shots that I attached).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; But whether the original poster is using ODS TAGSETS.EXCELXP or ODS EXCEL, there is no need to have a DATA step do the conversion to get leading zeroes, since both destinations have a way to handle that situation -- ODS TAGSETS.EXCELXP has an "external" style override method and ODS EXCEL has an internal method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jan 2015 18:46:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Losing-formats-using-an-ODS-to-Excel/m-p/177055#M12576</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2015-01-13T18:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: Losing formats using an ODS to Excel</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Losing-formats-using-an-ODS-to-Excel/m-p/177056#M12577</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This works perfectly! Thank you for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jan 2015 02:34:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Losing-formats-using-an-ODS-to-Excel/m-p/177056#M12577</guid>
      <dc:creator>dereck255</dc:creator>
      <dc:date>2015-01-22T02:34:39Z</dc:date>
    </item>
  </channel>
</rss>

