<?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 decimals in ods tagsets output in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/decimals-in-ods-tagsets-output/m-p/622873#M19858</link>
    <description>&lt;P&gt;data a;&lt;/P&gt;&lt;P&gt;For some reason, this code produces two decimals in the xml file.&amp;nbsp; &amp;nbsp;Is there way to round it to an integer?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;x=1;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;BR /&gt;select 1234567890 format=32. into: numval&lt;BR /&gt;from a;&lt;BR /&gt;%put &amp;amp;numval;&lt;/P&gt;&lt;P&gt;data b;&lt;BR /&gt;y=put(&amp;amp;numval,dollar15.);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;ods tagsets.excelxp file=[fileref];&lt;BR /&gt;proc print data=b;&lt;BR /&gt;run;&lt;BR /&gt;ods tagsets.excelxp close;&lt;/P&gt;</description>
    <pubDate>Thu, 06 Feb 2020 21:13:39 GMT</pubDate>
    <dc:creator>Batman</dc:creator>
    <dc:date>2020-02-06T21:13:39Z</dc:date>
    <item>
      <title>decimals in ods tagsets output</title>
      <link>https://communities.sas.com/t5/New-SAS-User/decimals-in-ods-tagsets-output/m-p/622873#M19858</link>
      <description>&lt;P&gt;data a;&lt;/P&gt;&lt;P&gt;For some reason, this code produces two decimals in the xml file.&amp;nbsp; &amp;nbsp;Is there way to round it to an integer?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;x=1;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;BR /&gt;select 1234567890 format=32. into: numval&lt;BR /&gt;from a;&lt;BR /&gt;%put &amp;amp;numval;&lt;/P&gt;&lt;P&gt;data b;&lt;BR /&gt;y=put(&amp;amp;numval,dollar15.);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;ods tagsets.excelxp file=[fileref];&lt;BR /&gt;proc print data=b;&lt;BR /&gt;run;&lt;BR /&gt;ods tagsets.excelxp close;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 21:13:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/decimals-in-ods-tagsets-output/m-p/622873#M19858</guid>
      <dc:creator>Batman</dc:creator>
      <dc:date>2020-02-06T21:13:39Z</dc:date>
    </item>
    <item>
      <title>Re: decimals in ods tagsets output</title>
      <link>https://communities.sas.com/t5/New-SAS-User/decimals-in-ods-tagsets-output/m-p/622927#M19862</link>
      <description>&lt;P&gt;If you look into the generated XML you find below:&lt;/P&gt;
&lt;PRE&gt;        &amp;lt;Cell ss:StyleID="data__l1" ss:Index="2"&amp;gt;&amp;lt;Data ss:Type="Number"&amp;gt;1234567890&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt;&lt;/PRE&gt;
&lt;P&gt;Excel then just applies the standard format for numbers which adds the two decimals.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using&amp;nbsp;ods tagsets.excelxp there might be ways to instruct SAS to create a type of Text/String and write the source variable without changing the string.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternatively use the more modern ODS EXCEL destination.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data dual;
  x=1;
  output;
  stop;
run;

%let numval=;
proc sql noprint;
  select 1234567890 format=32. into: numval
  from dual;
quit;
%put &amp;amp;=numval;

data b;
  y=put(&amp;amp;numval,dollar15.);
  output;
  stop;
run;

ods excel file='~/test.xlsx';

proc print data=b;
run;

ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can find a related discussion &lt;A href="https://communities.sas.com/t5/New-SAS-User/SAS-EG-output-report-issue/m-p/622550/highlight/true#M19790" target="_self"&gt;here&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2020 02:54:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/decimals-in-ods-tagsets-output/m-p/622927#M19862</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-02-07T02:54:06Z</dc:date>
    </item>
    <item>
      <title>Re: decimals in ods tagsets output</title>
      <link>https://communities.sas.com/t5/New-SAS-User/decimals-in-ods-tagsets-output/m-p/623234#M19901</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&amp;nbsp;There is also a data style element that is assigning a currency type.&lt;/P&gt;
&lt;P&gt;I spend some time with TAGATTR options and was able to create a type=string but it would get the currency symbol, commas and decimal point stripped out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried: 1) modify the created xml in Excel by deleting the cell&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2) entering the dollar formatted value using the Excel apostrophe before entering the value to get a string value&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3) save back to XML&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At which point I found that there was&lt;/P&gt;
&lt;PRE&gt;Type="String" X:ticked="1"&lt;/PRE&gt;
&lt;P&gt;I was able to get the TAGGATR to have that value BUT the StyleID was still pointing to that currency still and stripping the currency symbols. So there might be something in the tagset that treats Currency appearing values before applying the TAGATTR properties.&lt;/P&gt;
&lt;PRE&gt;&amp;lt;/Style&amp;gt;
&amp;lt;Style ss:ID="data__l1" ss:Parent="data__l"&amp;gt;
&amp;lt;Protection ss:Protected="1" /&amp;gt;
&amp;lt;NumberFormat ss:Format="Currency" /&amp;gt;
&amp;lt;/Style&amp;gt;

/* and then the value*/
&amp;lt;Cell ss:StyleID="data__l1" ss:Index="2"&amp;gt;&amp;lt;Data ss:Type="String" X:ticked="1"&amp;gt;1234567890&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At which point I gave up trying as I wasn't understanding what rules might be involved.&lt;/P&gt;</description>
      <pubDate>Sat, 08 Feb 2020 00:13:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/decimals-in-ods-tagsets-output/m-p/623234#M19901</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-02-08T00:13:32Z</dc:date>
    </item>
    <item>
      <title>Re: decimals in ods tagsets output</title>
      <link>https://communities.sas.com/t5/New-SAS-User/decimals-in-ods-tagsets-output/m-p/623240#M19902</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;Wouldn't be nice if there was a simple style override that allowed you to specify a Microsoft format for numbers? Really nice?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Wait a minute. There is a simple style override that you can use with both TAGSETS.EXCELXP and ODS EXCEL. It is the TAGATTR style override, as shown below:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="use_tagattr.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/35942iF23E1C4A38E56506/image-size/large?v=v2&amp;amp;px=999" role="button" title="use_tagattr.png" alt="use_tagattr.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can apply the $ format to the original numeric variable, as shown in the code, without needing to make a character variable and you can get rid of the decimal places. All in one simple Microsoft format. No need to reverse engineer the XML at all. I did an explicit right-justify on the character variable and an explicit center justify on the numeric variable. But as you can see, they have the SAME format in the Excel sheet.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;... gotta love the ODS developers!&lt;/P&gt;
&lt;P&gt;Cynthia&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;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Feb 2020 00:45:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/decimals-in-ods-tagsets-output/m-p/623240#M19902</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2020-02-08T00:45:06Z</dc:date>
    </item>
  </channel>
</rss>

