<?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 format when export to xlsx in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/losing-format-when-export-to-xlsx/m-p/172969#M44557</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try ODS TAGSETS.EXCELXP to create formatted data. When using proc export, Excel may do its own formatting.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 18 Feb 2015 09:52:37 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2015-02-18T09:52:37Z</dc:date>
    <item>
      <title>losing format when export to xlsx</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/losing-format-when-export-to-xlsx/m-p/172968#M44556</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;I have a dataset in sas with all the fields formatted the way I want but when I export to xlsx using the code below, I lose the formats.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style=": ; color: #000080; font-size: 10pt; font-family: Courier New;"&gt;proc export&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;data = dataset1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;outfile&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-size: 10pt; font-family: Courier New;"&gt;"...\dataset.xlsx"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;dbms = xlsx&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;replace&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;sheet = final;&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080;"&gt;run&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;Any way to keep the format?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Feb 2015 09:46:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/losing-format-when-export-to-xlsx/m-p/172968#M44556</guid>
      <dc:creator>brophymj</dc:creator>
      <dc:date>2015-02-18T09:46:45Z</dc:date>
    </item>
    <item>
      <title>Re: losing format when export to xlsx</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/losing-format-when-export-to-xlsx/m-p/172969#M44557</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try ODS TAGSETS.EXCELXP to create formatted data. When using proc export, Excel may do its own formatting.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Feb 2015 09:52:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/losing-format-when-export-to-xlsx/m-p/172969#M44557</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-02-18T09:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: losing format when export to xlsx</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/losing-format-when-export-to-xlsx/m-p/172970#M44558</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As KurtBremser notes, Excelxp tagset will give you more flexibility in your output files.&amp;nbsp; Here is an article talking about proc report + tagset + mso formats:&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" class="active_link" href="https://communities.sas.com/thread/47133" title="https://communities.sas.com/thread/47133"&gt;https://communities.sas.com/thread/47133&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Feb 2015 10:09:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/losing-format-when-export-to-xlsx/m-p/172970#M44558</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-02-18T10:09:13Z</dc:date>
    </item>
    <item>
      <title>Re: losing format when export to xlsx</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/losing-format-when-export-to-xlsx/m-p/172971#M44559</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to export to xlsx. I've tried using ODS TAGSETS.EXCELXP as...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;ODS tagsets.ExcelXP &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;FILE&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-size: 10pt; font-family: Courier New;"&gt;"...\oneway_output_by_year.xlsx"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #000080; font-size: 10pt; font-family: Courier New;"&gt;PRINT&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;DATA&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;=oneway_all4;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; ods tagsets.ExcelXP &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;CLOSE&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;When I run this I get an message saying "Do you want to open or save this file". When I select opn, I get a message saying "excel cannot open the file oneway_output_by_year.xlsx because the file format or file extension is not valid. Verify that the file has not been corrupted or and that the file extension matches the format of the file.". &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;Do you know what I'm doing wrong?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;Can the export be automated or do you have to save each time manually?&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Feb 2015 10:44:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/losing-format-when-export-to-xlsx/m-p/172971#M44559</guid>
      <dc:creator>brophymj</dc:creator>
      <dc:date>2015-02-18T10:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: losing format when export to xlsx</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/losing-format-when-export-to-xlsx/m-p/172972#M44560</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, I would change the proc print to be a proc report first off.&amp;nbsp; Also add a style.&amp;nbsp; Change the file extension to XLS:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;ods tagsets.excelxp file="xyz.xls" style=statistical;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;proc report data=oneway_all4 nowd;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; columns _all_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define ...;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;ods tagsets.excelxp close;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that the tagset actually creates XML output, which Excel then reads in and interprets.&amp;nbsp; To also note that in SAS 9.4 there is a libname statement through which you can create native XLSX files: &lt;A class="active_link" href="http://support.sas.com/documentation/cdl/en/acpcref/67382/HTML/default/viewer.htm#n0oj9f6i838mymn148890ckla700.htm" style="font-size: 10pt; line-height: 1.5em;" title="http://support.sas.com/documentation/cdl/en/acpcref/67382/HTML/default/viewer.htm#n0oj9f6i838mymn148890ckla700.htm"&gt;SAS/ACCESS(R) 9.4 Interface to PC Files: Reference, Third Edition&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Before 9.4 you would need to know the Open Office format to create them.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Feb 2015 10:56:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/losing-format-when-export-to-xlsx/m-p/172972#M44560</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-02-18T10:56:40Z</dc:date>
    </item>
    <item>
      <title>Re: losing format when export to xlsx</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/losing-format-when-export-to-xlsx/m-p/172973#M44561</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank RW9 but I'm still getting that error message when I try to open the file -when I do open it the format it the way I want it but the error message is annoying. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Feb 2015 11:05:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/losing-format-when-export-to-xlsx/m-p/172973#M44561</guid>
      <dc:creator>brophymj</dc:creator>
      <dc:date>2015-02-18T11:05:25Z</dc:date>
    </item>
    <item>
      <title>Re: losing format when export to xlsx</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/losing-format-when-export-to-xlsx/m-p/172974#M44562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, the "warning" message you get about the file being in a different format than expected is actually an Excel one, not controllable by SAS.&amp;nbsp; What it is saying is that a file with the extension XLSX is expected by Excel to be in its Open Office format.&amp;nbsp; What you are creating is XML.&amp;nbsp; So in reality you would want to create the file as xyz.xml, however on most peoples machines XML will open with a web browser not Excel by default, so by using the .xlsx extension you are fooling Windows into thinking it should open the file with Excel.&amp;nbsp; You could of course ask everyone to associate XML files to open with Excel and then you would avoid this message, but its probably a lot of effort.&amp;nbsp; If you have 9.4 then try the libname variety.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Feb 2015 11:22:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/losing-format-when-export-to-xlsx/m-p/172974#M44562</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-02-18T11:22:57Z</dc:date>
    </item>
    <item>
      <title>Re: losing format when export to xlsx</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/losing-format-when-export-to-xlsx/m-p/172975#M44563</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Save the file as .xml, and you don't get the warning.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Feb 2015 11:34:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/losing-format-when-export-to-xlsx/m-p/172975#M44563</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-02-18T11:34:10Z</dc:date>
    </item>
  </channel>
</rss>

