<?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: Custom SAS format with custom decimals in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Custom-SAS-format-with-custom-decimals/m-p/910921#M359209</link>
    <description>&lt;P&gt;I think your issue is the number of digit selectors in decimal positions. Once those are satisfied that's all the format displays.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you need 3, 4 or more decimals try a different Picture statement with the number of digit selectors to match, or at least one in the final decimal position.&lt;/P&gt;</description>
    <pubDate>Mon, 08 Jan 2024 21:25:50 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2024-01-08T21:25:50Z</dc:date>
    <item>
      <title>Custom SAS format with custom decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Custom-SAS-format-with-custom-decimals/m-p/910911#M359201</link>
      <description>&lt;P&gt;I was creating a custom format to handle the fact that the SAS built in format sizekmg does not handle terabytes. It works as intended, with the exception that I can't get it to change the number of decimals for anything over 1TB. As in, I have the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%let onetb=%sysevalf(1024**4); *1099511627776;
proc format ;
  picture sizekmgt (round)
          0       -&amp;lt; &amp;amp;onetb. = [sizekmg10.2]
          other    = '00000.99TB' (multiplier=%sysevalf(100/&amp;amp;onetb.)) ;
              *Multiplier 100 because we want 2 decimals;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My issue is that if I use e.g.&amp;nbsp;sizekmgt10.3 it will not change the number of decimals. I have tried a couple of different versions, but I can't get it to do what I want. Does anyone have any ideas on what I can do to fix this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And thanks to &lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961" target="_blank"&gt;@ChrisNZ&lt;/A&gt;&amp;nbsp;for the main example, I stole it and added the round part to it.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jan 2024 20:43:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Custom-SAS-format-with-custom-decimals/m-p/910911#M359201</guid>
      <dc:creator>hf_</dc:creator>
      <dc:date>2024-01-08T20:43:14Z</dc:date>
    </item>
    <item>
      <title>Re: Custom SAS format with custom decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Custom-SAS-format-with-custom-decimals/m-p/910918#M359206</link>
      <description>&lt;P&gt;I don't think you can do that.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could make a second format that does 3 decimal places.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let onetb=%sysevalf(1024**4); *1099511627776;
proc format ;
* Multiplier 100 because we want 2 decimals ;
picture sizekmgt (round)
  0      -&amp;lt; &amp;amp;onetb. = [sizekmg11.2]
  other  = '00009.99TB' (multiplier=%sysevalf(100/&amp;amp;onetb.)) 
;
picture size3kmgt (round)
  0      -&amp;lt; &amp;amp;onetb. = [sizekmg11.3]
  other  = '00009.999TB' (multiplier=%sysevalf(1000/&amp;amp;onetb.)) 
;
run;

data _null_;
  do k=1 to 5; 
    i=1024**k - 512**(k-1) ;
    put k (3*i) (sizekmgt. +1 size3kmgt. +1 :comma24.);
  end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results&lt;/P&gt;
&lt;PRE&gt;124  data _null_;
125    do k=1 to 5;
126      i=1024**k - 512**(k-1) ;
127      put k (3*i) (sizekmgt. +1 size3kmgt. +1 :comma24.);
128    end;
129  run;

1      1.00KB     0.999KB 1,023
2   1023.50KB  1023.500KB 1,048,064
3   1023.75MB  1023.750MB 1,073,479,680
4   1023.88GB  1023.875GB 1,099,377,410,048
5   1023.94TB  1023.938TB 1,125,831,187,365,888
&lt;/PRE&gt;</description>
      <pubDate>Mon, 08 Jan 2024 21:10:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Custom-SAS-format-with-custom-decimals/m-p/910918#M359206</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-01-08T21:10:11Z</dc:date>
    </item>
    <item>
      <title>Re: Custom SAS format with custom decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Custom-SAS-format-with-custom-decimals/m-p/910921#M359209</link>
      <description>&lt;P&gt;I think your issue is the number of digit selectors in decimal positions. Once those are satisfied that's all the format displays.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you need 3, 4 or more decimals try a different Picture statement with the number of digit selectors to match, or at least one in the final decimal position.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jan 2024 21:25:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Custom-SAS-format-with-custom-decimals/m-p/910921#M359209</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-01-08T21:25:50Z</dc:date>
    </item>
  </channel>
</rss>

