<?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: Replicate accounting number format like Excel in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Replicate-accounting-number-format-like-Excel/m-p/391311#M93971</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/6401"&gt;@HB&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Notice that in constructing a picture format, the number of characters in the prefix is supposed to change.&amp;nbsp; (I inadvertently had removed one of those blanks, but have corrected&amp;nbsp;that in the post above.)&amp;nbsp; Changing the size of the prefix will line up the dollar signs using the PICTURE format.&lt;/P&gt;</description>
    <pubDate>Mon, 28 Aug 2017 19:27:49 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2017-08-28T19:27:49Z</dc:date>
    <item>
      <title>Replicate accounting number format like Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replicate-accounting-number-format-like-Excel/m-p/391277#M93955</link>
      <description>&lt;P&gt;Is there a way to format a value as accounting to mimic the same format in Excel?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;$ &amp;nbsp; &amp;nbsp; 0.99&lt;/P&gt;&lt;P&gt;$ &amp;nbsp; &amp;nbsp; 1.00&amp;nbsp;&lt;/P&gt;&lt;P&gt;$ &amp;nbsp; 10.00&amp;nbsp;&lt;/P&gt;&lt;P&gt;$ 100.00&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(the currency sign is left aligned while the numeric value is right aligned)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2017 16:56:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replicate-accounting-number-format-like-Excel/m-p/391277#M93955</guid>
      <dc:creator>abcda</dc:creator>
      <dc:date>2017-08-28T16:56:44Z</dc:date>
    </item>
    <item>
      <title>Re: Replicate accounting number format like Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replicate-accounting-number-format-like-Excel/m-p/391286#M93961</link>
      <description>&lt;P&gt;I don't think SAS has a format statement that will do that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you really wanted to, you could turn numbers into character values and append spaces and a dollar sign to the front to make them look like that. But that seems silly.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2017 17:43:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replicate-accounting-number-format-like-Excel/m-p/391286#M93961</guid>
      <dc:creator>HB</dc:creator>
      <dc:date>2017-08-28T17:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: Replicate accounting number format like Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replicate-accounting-number-format-like-Excel/m-p/391296#M93966</link>
      <description>&lt;P&gt;While SAS doesn't have such a format, you can create your own.&amp;nbsp; Here's one way (you might want to add an extra blank after the dollar sign ... that's up to you):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;proc format;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;picture tst 0-&amp;lt; 10 = ' 9.99' (prefix='$&amp;nbsp; ')&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;10 - &amp;lt; 100 = ' 99.99' (prefix='$ ')&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;100- &amp;lt; 1000 = ' 999.99' (prefix='$');&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;　&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;data test;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;do i=0, 10, 50, 100; put i tst.; end;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;run;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2017 19:25:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replicate-accounting-number-format-like-Excel/m-p/391296#M93966</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-08-28T19:25:24Z</dc:date>
    </item>
    <item>
      <title>Re: Replicate accounting number format like Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replicate-accounting-number-format-like-Excel/m-p/391309#M93970</link>
      <description>&lt;P&gt;If i do&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data stuff;
   input mymoney;
datalines;
5.12
6.45
16.23
12.45
164.25
145.78
;
run;

proc format;
picture moneytest 
0 - &amp;lt; 10 = '    9.99' (prefix='$ ')
10 - &amp;lt; 100 = '   99.99' (prefix='$ ')
100- &amp;lt; 1000 = '	 999.99' (prefix='$ ');
run;

proc print;
	var mymoney;
	format mymoney moneytest.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I get&lt;/P&gt;
&lt;PRE&gt;                                        Obs    mymoney

                                         1       $ 5.12
                                         2       $ 6.45
                                         3      $ 16.23
                                         4      $ 12.45
                                         5     $ 164.25
                                         6     $ 145.78
&amp;#12;
&lt;/PRE&gt;
&lt;P&gt;But if i do&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data newmoney;
	set stuff;
	mycharmoney = put(mymoney,10.3);
	mycharmoney = '$' || mycharmoney;
run;

proc print;
	var mycharmoney;
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I get&lt;/P&gt;
&lt;PRE&gt;                                       Obs    mycharmoney

                                        1     $     5.12
                                        2     $     6.45
                                        3     $    16.23
                                        4     $    12.45
                                        5     $   164.25
                                        6     $   145.78

&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Aug 2017 19:22:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replicate-accounting-number-format-like-Excel/m-p/391309#M93970</guid>
      <dc:creator>HB</dc:creator>
      <dc:date>2017-08-28T19:22:55Z</dc:date>
    </item>
    <item>
      <title>Re: Replicate accounting number format like Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replicate-accounting-number-format-like-Excel/m-p/391311#M93971</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/6401"&gt;@HB&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Notice that in constructing a picture format, the number of characters in the prefix is supposed to change.&amp;nbsp; (I inadvertently had removed one of those blanks, but have corrected&amp;nbsp;that in the post above.)&amp;nbsp; Changing the size of the prefix will line up the dollar signs using the PICTURE format.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2017 19:27:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replicate-accounting-number-format-like-Excel/m-p/391311#M93971</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-08-28T19:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: Replicate accounting number format like Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replicate-accounting-number-format-like-Excel/m-p/391314#M93972</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I gotcha now. This "_9.00", "__9.00", "___9.00" doesn't seem to do any good. I think SAS collapses the spaces or something. &lt;BR /&gt;&lt;BR /&gt;But this "$_", "$__", "$___" gets the job done. Cool.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2017 19:45:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replicate-accounting-number-format-like-Excel/m-p/391314#M93972</guid>
      <dc:creator>HB</dc:creator>
      <dc:date>2017-08-28T19:45:06Z</dc:date>
    </item>
    <item>
      <title>Re: Replicate accounting number format like Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replicate-accounting-number-format-like-Excel/m-p/391316#M93973</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/6401"&gt;@HB&lt;/a&gt;&amp;nbsp;The space difference you are seeing from &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;'s solution is ODS output slightly reformatting things.&lt;/P&gt;
&lt;P&gt;Is going to depend on active style, ods destination and/or font.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc print data=newmoney;
   title "Simple Print";
	var mycharmoney /;
run;title;
proc print data=newmoney;
   title "With fixed width font ";
	var mycharmoney /style(data)=[fontfamily="Courier" ];
run; title;
proc print data=newmoney;
   title "With fixed width font and ASIS";
	var mycharmoney /style(data)=[fontfamily="Courier" ASIS=yes];
run;title;&lt;/PRE&gt;
&lt;P&gt;Differing results:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="branch"&gt;&lt;A name="IDX" target="_blank"&gt;&lt;/A&gt;
&lt;TABLE width="100%" class="systitleandfootercontainer" summary="Page Layout"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="l systemtitle"&gt;Simple Print&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;BR /&gt;
&lt;DIV&gt;
&lt;DIV align="left"&gt;
&lt;TABLE class="table" cellspacing="0" cellpadding="3" summary="Procedure Print: Data Set USER.NEWMONEY"&gt;&lt;COLGROUP&gt; &lt;COL /&gt;&lt;/COLGROUP&gt; &lt;COLGROUP&gt; &lt;COL /&gt;&lt;/COLGROUP&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="c m header" scope="col"&gt;Obs&lt;/TH&gt;
&lt;TH class="c m header" scope="col"&gt;mycharmoney&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="l m rowheader" scope="row"&gt;1&lt;/TH&gt;
&lt;TD class="l data"&gt;$ 5.12&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l m rowheader" scope="row"&gt;2&lt;/TH&gt;
&lt;TD class="l data"&gt;$ 6.45&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l m rowheader" scope="row"&gt;3&lt;/TH&gt;
&lt;TD class="l data"&gt;$ 16.23&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l m rowheader" scope="row"&gt;4&lt;/TH&gt;
&lt;TD class="l data"&gt;$ 12.45&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l m rowheader" scope="row"&gt;5&lt;/TH&gt;
&lt;TD class="l data"&gt;$ 164.25&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l m rowheader" scope="row"&gt;6&lt;/TH&gt;
&lt;TD class="l data"&gt;$ 145.78&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="branch"&gt;&lt;A name="IDX1" target="_blank"&gt;&lt;/A&gt;
&lt;TABLE width="100%" class="systitleandfootercontainer" summary="Page Layout"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="l systemtitle"&gt;With fixed width font&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;BR /&gt;
&lt;DIV&gt;
&lt;DIV align="left"&gt;
&lt;TABLE class="table" cellspacing="0" cellpadding="3" summary="Procedure Print: Data Set USER.NEWMONEY"&gt;&lt;COLGROUP&gt; &lt;COL /&gt;&lt;/COLGROUP&gt; &lt;COLGROUP&gt; &lt;COL /&gt;&lt;/COLGROUP&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="c m header" scope="col"&gt;Obs&lt;/TH&gt;
&lt;TH class="c m header" scope="col"&gt;mycharmoney&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="l m rowheader" scope="row"&gt;1&lt;/TH&gt;
&lt;TD class="l data" style="font-family: Courier;"&gt;$ 5.12&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l m rowheader" scope="row"&gt;2&lt;/TH&gt;
&lt;TD class="l data" style="font-family: Courier;"&gt;$ 6.45&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l m rowheader" scope="row"&gt;3&lt;/TH&gt;
&lt;TD class="l data" style="font-family: Courier;"&gt;$ 16.23&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l m rowheader" scope="row"&gt;4&lt;/TH&gt;
&lt;TD class="l data" style="font-family: Courier;"&gt;$ 12.45&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l m rowheader" scope="row"&gt;5&lt;/TH&gt;
&lt;TD class="l data" style="font-family: Courier;"&gt;$ 164.25&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l m rowheader" scope="row"&gt;6&lt;/TH&gt;
&lt;TD class="l data" style="font-family: Courier;"&gt;$ 145.78&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="branch"&gt;&lt;A name="IDX2" target="_blank"&gt;&lt;/A&gt;
&lt;TABLE width="100%" class="systitleandfootercontainer" summary="Page Layout"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="l systemtitle"&gt;With fixed width font and ASIS&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;BR /&gt;
&lt;DIV&gt;
&lt;DIV align="left"&gt;
&lt;TABLE class="table" cellspacing="0" cellpadding="3" summary="Procedure Print: Data Set USER.NEWMONEY"&gt;&lt;COLGROUP&gt; &lt;COL /&gt;&lt;/COLGROUP&gt; &lt;COLGROUP&gt; &lt;COL /&gt;&lt;/COLGROUP&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="c m header" scope="col"&gt;Obs&lt;/TH&gt;
&lt;TH class="c m header" scope="col"&gt;mycharmoney&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="l m rowheader" scope="row"&gt;1&lt;/TH&gt;
&lt;TD class="l data" style="font-family: Courier;"&gt;
&lt;PRE class="data" style="font-family: Courier;"&gt;$     5.12&lt;/PRE&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l m rowheader" scope="row"&gt;2&lt;/TH&gt;
&lt;TD class="l data" style="font-family: Courier;"&gt;
&lt;PRE class="data" style="font-family: Courier;"&gt;$     6.45&lt;/PRE&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l m rowheader" scope="row"&gt;3&lt;/TH&gt;
&lt;TD class="l data" style="font-family: Courier;"&gt;
&lt;PRE class="data" style="font-family: Courier;"&gt;$    16.23&lt;/PRE&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l m rowheader" scope="row"&gt;4&lt;/TH&gt;
&lt;TD class="l data" style="font-family: Courier;"&gt;
&lt;PRE class="data" style="font-family: Courier;"&gt;$    12.45&lt;/PRE&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l m rowheader" scope="row"&gt;5&lt;/TH&gt;
&lt;TD class="l data" style="font-family: Courier;"&gt;
&lt;PRE class="data" style="font-family: Courier;"&gt;$   164.25&lt;/PRE&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l m rowheader" scope="row"&gt;6&lt;/TH&gt;
&lt;TD class="l data" style="font-family: Courier;"&gt;
&lt;PRE class="data" style="font-family: Courier;"&gt;$   145.78&lt;/PRE&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;I have no idea why the forum is rendering that last table with the &amp;lt; &amp;gt; bit but in the default HTML results viewer both the $ and Decimals align which I do not get with the simple print even of the string variable.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2017 19:57:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replicate-accounting-number-format-like-Excel/m-p/391316#M93973</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-08-28T19:57:16Z</dc:date>
    </item>
  </channel>
</rss>

