<?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: maintain sas formats when exporting to xlsx in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/maintain-sas-formats-when-exporting-to-xlsx/m-p/714207#M220467</link>
    <description>&lt;P&gt;The nice thing about text files is that you can always look at what you created (when writing from SAS) with a simple text viewer/editor. You can't look at an xlsx file (apart from opening it with Excel or another piece of Office software), unless you unpack the archive and try to make sense of the XML data in there, which is not always trivial.&lt;/P&gt;</description>
    <pubDate>Tue, 26 Jan 2021 10:47:53 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2021-01-26T10:47:53Z</dc:date>
    <item>
      <title>maintain sas formats when exporting to xlsx</title>
      <link>https://communities.sas.com/t5/SAS-Programming/maintain-sas-formats-when-exporting-to-xlsx/m-p/714199#M220461</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have a large data set which I want to export to excel (xlsx)&lt;/P&gt;
&lt;P&gt;I realise that the formats are changed in excel. I tried using&lt;/P&gt;
&lt;P&gt;ods destination but it gives an error message saying not enough memory.&lt;/P&gt;
&lt;P&gt;Any help?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods excel file='mypath\test.xlsx' ;
proc print data=mydata;
run;
ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Jan 2021 09:45:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/maintain-sas-formats-when-exporting-to-xlsx/m-p/714199#M220461</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2021-01-26T09:45:20Z</dc:date>
    </item>
    <item>
      <title>Re: maintain sas formats when exporting to xlsx</title>
      <link>https://communities.sas.com/t5/SAS-Programming/maintain-sas-formats-when-exporting-to-xlsx/m-p/714201#M220463</link>
      <description>&lt;P&gt;Write your data to a csv file with a data step (use the semicolon as delimiter), and use the formats you want; then the only issue can come from what Excel&amp;nbsp;&lt;EM&gt;thinks&lt;/EM&gt; is in the data. The&amp;nbsp;&lt;EM&gt;thinking&lt;/EM&gt; of Excel is best described with Maxim 31.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jan 2021 09:53:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/maintain-sas-formats-when-exporting-to-xlsx/m-p/714201#M220463</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-01-26T09:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: maintain sas formats when exporting to xlsx</title>
      <link>https://communities.sas.com/t5/SAS-Programming/maintain-sas-formats-when-exporting-to-xlsx/m-p/714204#M220465</link>
      <description>Okay, thanks</description>
      <pubDate>Tue, 26 Jan 2021 10:35:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/maintain-sas-formats-when-exporting-to-xlsx/m-p/714204#M220465</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2021-01-26T10:35:25Z</dc:date>
    </item>
    <item>
      <title>Re: maintain sas formats when exporting to xlsx</title>
      <link>https://communities.sas.com/t5/SAS-Programming/maintain-sas-formats-when-exporting-to-xlsx/m-p/714207#M220467</link>
      <description>&lt;P&gt;The nice thing about text files is that you can always look at what you created (when writing from SAS) with a simple text viewer/editor. You can't look at an xlsx file (apart from opening it with Excel or another piece of Office software), unless you unpack the archive and try to make sense of the XML data in there, which is not always trivial.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jan 2021 10:47:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/maintain-sas-formats-when-exporting-to-xlsx/m-p/714207#M220467</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-01-26T10:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: maintain sas formats when exporting to xlsx</title>
      <link>https://communities.sas.com/t5/SAS-Programming/maintain-sas-formats-when-exporting-to-xlsx/m-p/714216#M220470</link>
      <description>&lt;P&gt;Please show proc contents of the dataset, so that we actually see the formats. It could also be useful to know which sas version you are using.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jan 2021 11:11:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/maintain-sas-formats-when-exporting-to-xlsx/m-p/714216#M220470</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-01-26T11:11:52Z</dc:date>
    </item>
    <item>
      <title>Re: maintain sas formats when exporting to xlsx</title>
      <link>https://communities.sas.com/t5/SAS-Programming/maintain-sas-formats-when-exporting-to-xlsx/m-p/714236#M220482</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/168930"&gt;@Anita_n&lt;/a&gt;&amp;nbsp;.&lt;BR /&gt;Will this be useful to you?&lt;BR /&gt;&lt;A href="https://www.mwsug.org/proceedings/2015/PO/MWSUG-2015-PO-01.pdf" target="_self"&gt;Keep the Formats When Exporting to Excel&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jan 2021 13:17:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/maintain-sas-formats-when-exporting-to-xlsx/m-p/714236#M220482</guid>
      <dc:creator>Miracle</dc:creator>
      <dc:date>2021-01-26T13:17:18Z</dc:date>
    </item>
    <item>
      <title>Re: maintain sas formats when exporting to xlsx</title>
      <link>https://communities.sas.com/t5/SAS-Programming/maintain-sas-formats-when-exporting-to-xlsx/m-p/714250#M220488</link>
      <description>&lt;P&gt;Thanks to you all. I ended up using a different program to export it to excel. Otherwise it wouldn't work. I tried all suggested ways. Am very grateful for your frequent support&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jan 2021 13:55:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/maintain-sas-formats-when-exporting-to-xlsx/m-p/714250#M220488</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2021-01-26T13:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: maintain sas formats when exporting to xlsx</title>
      <link>https://communities.sas.com/t5/SAS-Programming/maintain-sas-formats-when-exporting-to-xlsx/m-p/714262#M220491</link>
      <description>&lt;P&gt;Could you please share the solution that finally worked for you, and information about the SAS formats involved?&lt;/P&gt;
&lt;P&gt;This will be helpful to anyone else who comes across this thread in the future.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jan 2021 14:14:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/maintain-sas-formats-when-exporting-to-xlsx/m-p/714262#M220491</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-01-26T14:14:04Z</dc:date>
    </item>
    <item>
      <title>Re: maintain sas formats when exporting to xlsx</title>
      <link>https://communities.sas.com/t5/SAS-Programming/maintain-sas-formats-when-exporting-to-xlsx/m-p/714281#M220495</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;here is a way to format your excel output and tell excel to use the formats &lt;STRONG&gt;you&lt;/STRONG&gt; want:&lt;/P&gt;
&lt;PRE&gt;data class(label='test data');
set sashelp.class;
retain date 0;
if _N_ eq 1 then date=datepart(today());
else date=date+1;
long_n=age/height/weight**2;
format date is8601da.;
run;
ods excel file='mypath\test.xlsx' ;
   PROC REPORT data=class nowindows split='$'
      style(header)=[font=(Arial, 10pt, bold) just=c verticalalign=m protectspecialchars=on borderstyle=solid borderwidth=1pt bordercolor=lightgray]
      style(column)=[font=(Arial, 10pt)       just=c verticalalign=m protectspecialchars=on borderstyle=solid borderwidth=1pt bordercolor=lightgray]
      ;
      COLUMN name sex age height weight date long_n;

      DEFINE name      / order   style=[just=l cellwidth=7.0cm tagattr='type:String format:Text wrap:yes'] style(header)=[just=l] "Name";
      DEFINE sex       / display style=[just=l cellwidth=6.0cm tagattr='type:String format:Text wrap:yes'] style(header)=[just=l] "Sex";
      DEFINE age       / display style=[just=r cellwidth=2.5cm tagattr='format:0000'] style(header)=[just=c] "A$g$e";
      DEFINE height    / display style=[just=r cellwidth=2.5cm tagattr='format:?/?'] style(header)=[just=c] "Height";
      DEFINE weight    / display style=[just=r cellwidth=2.5cm tagattr='format:[Red][&amp;gt;=100]0.0;[Blue][&amp;gt;=90]0.0;0.0'] style(header)=[just=c] "Weight";
      DEFINE date      / display style=[just=r cellwidth=2.5cm tagattr='type:DateTime format:YYYY-MM-DD'] style(header)=[just=c] "Date";
      DEFINE long_n    / display style=[just=r cellwidth=4.5cm tagattr='format:#0.############################# '] style(header)=[just=c] "Long_n";

      compute before name / style=[font=(Arial, 6pt) just=l background=aqua];
         line ' ';
      endcomp;
   RUN;
ods excel close;&lt;/PRE&gt;
&lt;P&gt;and some links to go even further beyond &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.philasug.org/Presentations/201306/ODS_and_Microsoft_Office.pdf" target="_blank" rel="noopener"&gt;http://www.philasug.org/Presentations/201306/ODS_and_Microsoft_Office.pdf&lt;/A&gt;&amp;nbsp;(conditional formatting on p.23)&lt;/P&gt;
&lt;P&gt;&lt;A href="https://exceljet.net/custom-number-formats" target="_blank" rel="noopener"&gt;https://exceljet.net/custom-number-formats&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jan 2021 14:46:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/maintain-sas-formats-when-exporting-to-xlsx/m-p/714281#M220495</guid>
      <dc:creator>Oligolas</dc:creator>
      <dc:date>2021-01-26T14:46:18Z</dc:date>
    </item>
    <item>
      <title>Re: maintain sas formats when exporting to xlsx</title>
      <link>https://communities.sas.com/t5/SAS-Programming/maintain-sas-formats-when-exporting-to-xlsx/m-p/714283#M220496</link>
      <description>I used Stat-Transfer to export the data to excel, because it wasn't working SAS. The Date Variables were always converted back to text, I have a variable with 10 decimal places which I previously reduced with COMMA7.2 to 2decimal places. This was also converted back to 10 decimal places. Those were the problems I encountered using proc export</description>
      <pubDate>Tue, 26 Jan 2021 14:48:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/maintain-sas-formats-when-exporting-to-xlsx/m-p/714283#M220496</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2021-01-26T14:48:49Z</dc:date>
    </item>
  </channel>
</rss>

