<?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: From SAS to Excel - keeping number type while formatting in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/From-SAS-to-Excel-keeping-number-type-while-formatting/m-p/845915#M26088</link>
    <description>&lt;P&gt;Thank you, Ksharp, for pointing me to this excellent blog post!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Multipla99&lt;/P&gt;</description>
    <pubDate>Wed, 23 Nov 2022 12:54:43 GMT</pubDate>
    <dc:creator>Multipla99</dc:creator>
    <dc:date>2022-11-23T12:54:43Z</dc:date>
    <item>
      <title>From SAS to Excel - keeping number type while formatting</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/From-SAS-to-Excel-keeping-number-type-while-formatting/m-p/845694#M26081</link>
      <description>&lt;P&gt;ODS Excel and Proc Report is a powerful combination that let us enjoy also our SAS formattade values in Excel. However, I still wonder if there is a way to preserve the data type numeric as number when I send the formatted data from SAS to Excel.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For illustration please see code below. In the code the Swedish locale is used to allow for national formatting, NLNUM12.2, with decimal comma and space as thousand delimiter. The result looks wonderful in Excel. However, the values in the column Invoice are not numbers and can't be used for calculations.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can I send formatted values from SAS to Excel and also tell Excel to interpret them as numbers? (In the Swedish version of Excel it's possible to format values with decimal comma and space as thousand delimiter, while at the same time maintaining the data type number.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options locale= sv_se;
goptions device= png;
ods excel                                                
file= "C:\Temp\Cars.xlsx"
; 
proc report
	data= sashelp.cars
	;
	column origin invoice
	; 
	define origin 							
	/ group									
	;
	define invoice 									
	/	analysis 
		format= NLNUM12.2
	;
run
;
ods excel close;        
goptions reset= goptions;  
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Skärmbild 2022-11-22 163434.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/77553i5222D918D3CF4CFA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Skärmbild 2022-11-22 163434.png" alt="Skärmbild 2022-11-22 163434.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2022 15:36:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/From-SAS-to-Excel-keeping-number-type-while-formatting/m-p/845694#M26081</guid>
      <dc:creator>Multipla99</dc:creator>
      <dc:date>2022-11-22T15:36:07Z</dc:date>
    </item>
    <item>
      <title>Re: From SAS to Excel - keeping number type while formatting</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/From-SAS-to-Excel-keeping-number-type-while-formatting/m-p/845747#M26082</link>
      <description>&lt;P&gt;Can you post what sas format has Invoice variable?&lt;/P&gt;
&lt;P&gt;Within SAS, assuming the format is comma12.2, when Invoice is displayed is it like 3.571.144,00 (european option) ?&lt;/P&gt;
&lt;P&gt;It seems as if commas are diaplayed as blank space ?!&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2022 18:36:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/From-SAS-to-Excel-keeping-number-type-while-formatting/m-p/845747#M26082</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2022-11-22T18:36:43Z</dc:date>
    </item>
    <item>
      <title>Re: From SAS to Excel - keeping number type while formatting</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/From-SAS-to-Excel-keeping-number-type-while-formatting/m-p/845750#M26083</link>
      <description>Hi:&lt;BR /&gt;  I believe you may need to use a STYLE override in PROC REPORT that changes the TAGATTR style attribute for TYPE. Here's the documentation page for ODS EXCEL &lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/odsug/p09n5pw9ol0897n1qe04zeur27rv.htm#p1hoqu3lkmdf6wn1stuwbyt7yyua" target="_blank"&gt;https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/odsug/p09n5pw9ol0897n1qe04zeur27rv.htm#p1hoqu3lkmdf6wn1stuwbyt7yyua&lt;/A&gt;  and if you look at Examples 2 and 3, you'll see how to use TAGATTR with TYPE:number and see whether that works for you.&lt;BR /&gt;Cynthia</description>
      <pubDate>Tue, 22 Nov 2022 18:40:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/From-SAS-to-Excel-keeping-number-type-while-formatting/m-p/845750#M26083</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2022-11-22T18:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: From SAS to Excel - keeping number type while formatting</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/From-SAS-to-Excel-keeping-number-type-while-formatting/m-p/845821#M26084</link>
      <description>Yes. As Cynthia said you need style TAGATTR= .&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/sgf/2022/10/21/formatting-your-microsoft-excel-output-using-ods-excel/" target="_blank"&gt;https://blogs.sas.com/content/sgf/2022/10/21/formatting-your-microsoft-excel-output-using-ods-excel/&lt;/A&gt;</description>
      <pubDate>Wed, 23 Nov 2022 02:47:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/From-SAS-to-Excel-keeping-number-type-while-formatting/m-p/845821#M26084</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-11-23T02:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: From SAS to Excel - keeping number type while formatting</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/From-SAS-to-Excel-keeping-number-type-while-formatting/m-p/845824#M26085</link>
      <description>&lt;P&gt;The LOCALE setting will control how NLNUM format displays the values.&amp;nbsp; Which is great for a PDF or simple text output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But for Excel you need to tell Excel how IT should display the values. Use the /style option and TAGATTR setting.&amp;nbsp; So this format string tells Excel to use two decimal places and insert thousand separators.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;style(data)={tagattr="format:#,##0.00"}&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now Excel will display two decimal places and thousand separator.&amp;nbsp; It should use the normal characters for those options that the computer that is viewing the XLSX file uses even though the custom formatting instruction is using comma and period.&amp;nbsp; So if you are viewing the file in Sweden then it should do what you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If for some reason it is still not display properly in Excel you can use the Options -&amp;gt; Advanced editting options and un-check the "Use system separators" selection you can then fill in the decimal and thousands separator character in the two text boxes there.&amp;nbsp;&amp;nbsp;I don't know how to override the default setting via code from SAS however.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that if you are NOT also sending that PROC REPORT output to some other open ODS output destination there is probably no need to attach the NLNUM format to the variable.&amp;nbsp; That just controls how SAS formats the string it uses to pass the number to Excel.&amp;nbsp; And Excel is notorious for ignoring the original style that numbers were entered with. So it is probably not necessary to add thousand separators there.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2022 03:20:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/From-SAS-to-Excel-keeping-number-type-while-formatting/m-p/845824#M26085</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-11-23T03:20:25Z</dc:date>
    </item>
    <item>
      <title>Re: From SAS to Excel - keeping number type while formatting</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/From-SAS-to-Excel-keeping-number-type-while-formatting/m-p/845871#M26086</link>
      <description>It's the NLNUMw.d format under Swedish locale. &lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.2/nlsref/n15n1e10clx3qpn1vrnd0awyhd2s.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.2/nlsref/n15n1e10clx3qpn1vrnd0awyhd2s.htm&lt;/A&gt;</description>
      <pubDate>Wed, 23 Nov 2022 09:04:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/From-SAS-to-Excel-keeping-number-type-while-formatting/m-p/845871#M26086</guid>
      <dc:creator>Multipla99</dc:creator>
      <dc:date>2022-11-23T09:04:41Z</dc:date>
    </item>
    <item>
      <title>Re: From SAS to Excel - keeping number type while formatting</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/From-SAS-to-Excel-keeping-number-type-while-formatting/m-p/845913#M26087</link>
      <description>&lt;P&gt;Thank you, Cynthia! This really did the trick! I'm very excited! &lt;BR /&gt;&lt;BR /&gt;Maybe you could also tell me what is the function of "_" in the "format:¥#,##0.00_" part? &lt;BR /&gt;&lt;BR /&gt;Multipla99&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2022 12:54:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/From-SAS-to-Excel-keeping-number-type-while-formatting/m-p/845913#M26087</guid>
      <dc:creator>Multipla99</dc:creator>
      <dc:date>2022-11-23T12:54:10Z</dc:date>
    </item>
    <item>
      <title>Re: From SAS to Excel - keeping number type while formatting</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/From-SAS-to-Excel-keeping-number-type-while-formatting/m-p/845915#M26088</link>
      <description>&lt;P&gt;Thank you, Ksharp, for pointing me to this excellent blog post!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Multipla99&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2022 12:54:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/From-SAS-to-Excel-keeping-number-type-while-formatting/m-p/845915#M26088</guid>
      <dc:creator>Multipla99</dc:creator>
      <dc:date>2022-11-23T12:54:43Z</dc:date>
    </item>
    <item>
      <title>Re: From SAS to Excel - keeping number type while formatting</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/From-SAS-to-Excel-keeping-number-type-while-formatting/m-p/845917#M26089</link>
      <description>Thank you very much, Tom! &lt;BR /&gt;&lt;BR /&gt;Especially I appreciate you clarification that my national version of Excel will adapt this formatting to the national standard. Sometimes life is really easy!&lt;BR /&gt;&lt;BR /&gt;Multipla99</description>
      <pubDate>Wed, 23 Nov 2022 12:53:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/From-SAS-to-Excel-keeping-number-type-while-formatting/m-p/845917#M26089</guid>
      <dc:creator>Multipla99</dc:creator>
      <dc:date>2022-11-23T12:53:29Z</dc:date>
    </item>
    <item>
      <title>Re: From SAS to Excel - keeping number type while formatting</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/From-SAS-to-Excel-keeping-number-type-while-formatting/m-p/846179#M26090</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; That is a Microsoft rule about what characters can be used in a custom format. You can read about them here: &lt;A href="https://www.thespreadsheetguru.com/blog/excel-custom-number-format-rules" target="_blank"&gt;https://www.thespreadsheetguru.com/blog/excel-custom-number-format-rules&lt;/A&gt; and of course, on the Microsoft site, which I couldn't find the link for. Here's a short list from the web page:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_0-1669303409342.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/77675i4DF5040B0B1EC7E5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_0-1669303409342.png" alt="Cynthia_sas_0-1669303409342.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Hope this helps explain it. I rarely use the _ in my custom formats with TAGATTR, but that's just my preference.&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Thu, 24 Nov 2022 15:24:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/From-SAS-to-Excel-keeping-number-type-while-formatting/m-p/846179#M26090</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2022-11-24T15:24:33Z</dc:date>
    </item>
    <item>
      <title>Re: From SAS to Excel - keeping number type while formatting</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/From-SAS-to-Excel-keeping-number-type-while-formatting/m-p/846221#M26091</link>
      <description>Thank you very much, Cynthia! &lt;BR /&gt;&lt;BR /&gt;This link that you provided explains a lot. I'm also happy to hear that I'm not the only having difficulties to find this information on the Microsoft site.&lt;BR /&gt;&lt;BR /&gt;All the best,&lt;BR /&gt;Multipla99</description>
      <pubDate>Thu, 24 Nov 2022 20:31:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/From-SAS-to-Excel-keeping-number-type-while-formatting/m-p/846221#M26091</guid>
      <dc:creator>Multipla99</dc:creator>
      <dc:date>2022-11-24T20:31:43Z</dc:date>
    </item>
  </channel>
</rss>

