<?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 proc format for missing and other in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-format-for-missing-and-other/m-p/733388#M228536</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to set up a format but having some trouble. I'd like to set missing values to 0, set values 1-10 as *, and any other value/greater than 10 to just remain the same. Then I'd like to use the format in a proc sql step.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I currently have the following:&lt;/P&gt;&lt;P&gt;proc format;&lt;/P&gt;&lt;P&gt;VALUE suppressf&lt;/P&gt;&lt;P&gt;.&amp;nbsp; = 0&lt;/P&gt;&lt;P&gt;1-10 = '*'&lt;/P&gt;&lt;P&gt;other= ' ';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;select year, month, put((count(*)), suppressf.) as recordcnt&lt;/P&gt;&lt;P&gt;from ddata.d2020&lt;/P&gt;&lt;P&gt;group by year, month;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run this, it looks like the * value is working, but the ones that were missing get dropped and the other value ones are blank. (also for clarification, if there was a value of 17, i'd want it to remain 17 since it's not missing or in the range of 1-10.) I'm pretty sure there is an issue in the way i'm defining the format, as I've done other formats in the proc sql step in a similar way, and those have worked as intended. Just not sure what to fix.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be really appreciated!&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>Tue, 13 Apr 2021 17:39:44 GMT</pubDate>
    <dc:creator>user23</dc:creator>
    <dc:date>2021-04-13T17:39:44Z</dc:date>
    <item>
      <title>proc format for missing and other</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-format-for-missing-and-other/m-p/733388#M228536</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to set up a format but having some trouble. I'd like to set missing values to 0, set values 1-10 as *, and any other value/greater than 10 to just remain the same. Then I'd like to use the format in a proc sql step.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I currently have the following:&lt;/P&gt;&lt;P&gt;proc format;&lt;/P&gt;&lt;P&gt;VALUE suppressf&lt;/P&gt;&lt;P&gt;.&amp;nbsp; = 0&lt;/P&gt;&lt;P&gt;1-10 = '*'&lt;/P&gt;&lt;P&gt;other= ' ';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;select year, month, put((count(*)), suppressf.) as recordcnt&lt;/P&gt;&lt;P&gt;from ddata.d2020&lt;/P&gt;&lt;P&gt;group by year, month;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run this, it looks like the * value is working, but the ones that were missing get dropped and the other value ones are blank. (also for clarification, if there was a value of 17, i'd want it to remain 17 since it's not missing or in the range of 1-10.) I'm pretty sure there is an issue in the way i'm defining the format, as I've done other formats in the proc sql step in a similar way, and those have worked as intended. Just not sure what to fix.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be really appreciated!&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>Tue, 13 Apr 2021 17:39:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-format-for-missing-and-other/m-p/733388#M228536</guid>
      <dc:creator>user23</dc:creator>
      <dc:date>2021-04-13T17:39:44Z</dc:date>
    </item>
    <item>
      <title>Re: proc format for missing and other</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-format-for-missing-and-other/m-p/733423#M228542</link>
      <description>&lt;P&gt;If you want "other" remain the same, that is un-formatted, then remove "other=" from the format definition and specify default width to accommodate un-formatted values :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
   VALUE suppressf (default=10) 
   .  = '0'
   1-10 = '*'
   ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Apr 2021 20:10:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-format-for-missing-and-other/m-p/733423#M228542</guid>
      <dc:creator>LeonidBatkhan</dc:creator>
      <dc:date>2021-04-28T20:10:41Z</dc:date>
    </item>
    <item>
      <title>Re: proc format for missing and other</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-format-for-missing-and-other/m-p/733504#M228551</link>
      <description>&lt;P&gt;I tried that but I'm still getting blanks for the ones that I want to stay unformatted.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 20:26:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-format-for-missing-and-other/m-p/733504#M228551</guid>
      <dc:creator>user23</dc:creator>
      <dc:date>2021-04-13T20:26:37Z</dc:date>
    </item>
    <item>
      <title>Re: proc format for missing and other</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-format-for-missing-and-other/m-p/733518#M228553</link>
      <description>&lt;P&gt;That's because you are using the PUT function. Try it by just applying the format:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select year, month, count(*) as recordcnt format = suppressf.
from ddata.d2020
group by year, month;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Apr 2021 20:47:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-format-for-missing-and-other/m-p/733518#M228553</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-04-13T20:47:33Z</dc:date>
    </item>
    <item>
      <title>Re: proc format for missing and other</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-format-for-missing-and-other/m-p/733534#M228554</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
  VALUE suppressf
  . = '0'
  1-10 = '*'
  other = [comma10.]
;
run;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Or specify default length:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
  VALUE suppressf (default=10)
  . = '0'
  1-10 = '*'
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Apr 2021 21:15:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-format-for-missing-and-other/m-p/733534#M228554</guid>
      <dc:creator>LeonidBatkhan</dc:creator>
      <dc:date>2021-04-13T21:15:12Z</dc:date>
    </item>
    <item>
      <title>Re: proc format for missing and other</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-format-for-missing-and-other/m-p/733552#M228560</link>
      <description>&lt;P&gt;You are getting blanks because you told it output a blank if the value was not one of the values you explicitly assigned display strings.&lt;/P&gt;
&lt;P&gt;You could specify the format you want to use for the other values.&amp;nbsp; Perhaps BEST12? or COMMA?.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;VALUE suppressf 
  .  = '0'
1-10 = '*'
 other = [best12.] 
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could not include the OTHER clause, but then you need to set a default length otherwise SAS will guess you want to use only 1 character to display the values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;VALUE suppressf (default=12)
  .  = '0'
1-10 = '*'
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that numeric formats normally right align so the PUT() results might be confusing since normal numeric formats will have leading spaces and your strings don't.&lt;/P&gt;
&lt;PRE&gt;       i  formatted_i
----------------------
       .  0
      -1            -1
       0             0
       1  *
      10  *
      11            11
    5555          5555

&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 22:03:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-format-for-missing-and-other/m-p/733552#M228560</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-04-13T22:03:29Z</dc:date>
    </item>
    <item>
      <title>Re: proc format for missing and other</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-format-for-missing-and-other/m-p/733561#M228565</link>
      <description>&lt;P&gt;One way to apply the different explanations offered (other= is wrong, format length is wrong, formatting is right justified) is the change you code to:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
VALUE suppressf
.  = 0
1-10 = '*'
;
 
proc sql;
select year, month, put((count(*)), suppressf12. -l) as recordcnt
from ddata.d2020
group by year, month;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 22:56:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-format-for-missing-and-other/m-p/733561#M228565</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-04-13T22:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: proc format for missing and other</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-format-for-missing-and-other/m-p/733975#M228696</link>
      <description>&lt;P&gt;Thank you all, it is working now! Didn't think about adding the default length or specifying a format for other.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Apr 2021 21:55:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-format-for-missing-and-other/m-p/733975#M228696</guid>
      <dc:creator>user23</dc:creator>
      <dc:date>2021-04-14T21:55:27Z</dc:date>
    </item>
  </channel>
</rss>

