<?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 output proc report: No zeros in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/output-proc-report-No-zeros/m-p/760581#M240512</link>
    <description>&lt;P&gt;Hi Forum,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a SAS-Output with Zeros in serval cells. These are the result of a formular many steps earlier. But: I dont want to get these Zeros in my output. I actually want SAS to do: If the result=zero then give me a "-" in this cell.&lt;/P&gt;
&lt;P&gt;Is it for example in the output-option doable?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Thank you!&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 10 Aug 2021 11:51:32 GMT</pubDate>
    <dc:creator>Konkordanz</dc:creator>
    <dc:date>2021-08-10T11:51:32Z</dc:date>
    <item>
      <title>output proc report: No zeros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/output-proc-report-No-zeros/m-p/760581#M240512</link>
      <description>&lt;P&gt;Hi Forum,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a SAS-Output with Zeros in serval cells. These are the result of a formular many steps earlier. But: I dont want to get these Zeros in my output. I actually want SAS to do: If the result=zero then give me a "-" in this cell.&lt;/P&gt;
&lt;P&gt;Is it for example in the output-option doable?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Thank you!&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Aug 2021 11:51:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/output-proc-report-No-zeros/m-p/760581#M240512</guid>
      <dc:creator>Konkordanz</dc:creator>
      <dc:date>2021-08-10T11:51:32Z</dc:date>
    </item>
    <item>
      <title>Re: output proc report: No zeros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/output-proc-report-No-zeros/m-p/760592#M240516</link>
      <description>&lt;P&gt;Are your variables numeric or character? I usually made everything character for proc report. Make a data step before proc report and convert the character variable to '-'.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Aug 2021 12:14:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/output-proc-report-No-zeros/m-p/760592#M240516</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2021-08-10T12:14:47Z</dc:date>
    </item>
    <item>
      <title>Re: output proc report: No zeros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/output-proc-report-No-zeros/m-p/760607#M240520</link>
      <description>&lt;P&gt;A custom format can be used to make 0 appear differently.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
    value nozero 0='-' other=[best10.2];
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and then assign this format to the variable in the PROC REPORT DEFINE statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Aug 2021 12:50:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/output-proc-report-No-zeros/m-p/760607#M240520</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-08-10T12:50:50Z</dc:date>
    </item>
    <item>
      <title>Re: output proc report: No zeros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/output-proc-report-No-zeros/m-p/760864#M240661</link>
      <description>&lt;P&gt;Thank you both for your answers, good ideas.&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt; : I tried also your way to understand the proc-format-thing. But it doesnt work. I tried this code, but where is the problem of my attemption?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input city $ price;
datalines;
Dresden 2005
Berlin 0
Frankfurt 0
Bonn 2
Berlin 4030
Bonn 0
Dresden 2005
Frankfurt 6053
Berlin 0
Frankfurt 0
Dresden 0
Bonn 0
Berlin 4030
Frankfurt 0
Bonn 3050
Dresden 0
;
run;

proc format;
    value $nozero 0='-' other=[best10.2];
run;

proc report data=have;
column city price;
define city / display;
define price / display format=$nozero;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 11 Aug 2021 08:47:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/output-proc-report-No-zeros/m-p/760864#M240661</guid>
      <dc:creator>Konkordanz</dc:creator>
      <dc:date>2021-08-11T08:47:43Z</dc:date>
    </item>
    <item>
      <title>Re: output proc report: No zeros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/output-proc-report-No-zeros/m-p/760865#M240662</link>
      <description>&lt;P&gt;Your code just needs a small tweak to work.&lt;/P&gt;
&lt;P&gt;1. Price is numerical so the format must be numerical (=format name without a dollar sign)&lt;/P&gt;
&lt;P&gt;2. Calling a format requires a dot added to the format name&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input city $ price;
  datalines;
Dresden 2005
Berlin 0
Frankfurt 0
Bonn 2
Berlin 4030
Bonn 0
Dresden 2005
Frankfurt 6053
Berlin 0
Frankfurt 0
Dresden 0
Bonn 0
Berlin 4030
Frankfurt 0
Bonn 3050
Dresden 0
;
run;

proc format;
  value nozero 0='-' other=[best10.2];
run;

proc report data=have;
  column city price;
  define city / display;
  define price / display format=nozero.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 11 Aug 2021 09:02:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/output-proc-report-No-zeros/m-p/760865#M240662</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-08-11T09:02:27Z</dc:date>
    </item>
    <item>
      <title>Re: output proc report: No zeros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/output-proc-report-No-zeros/m-p/760873#M240667</link>
      <description>&lt;P&gt;Maxim 2: Read the Log.&lt;/P&gt;
&lt;P&gt;This is your first clue:&lt;/P&gt;
&lt;PRE&gt; 98         define price / display format=$nozero;
                                          _
                                          22
                                          200
 ERROR 22-322: Expecting ein Formatname.  
 ERROR 200-322: The symbol is not recognized and will be ignored.
&lt;/PRE&gt;
&lt;P&gt;OK, so $nozero is not recognized as a format. That is because format references always need a dot.&lt;/P&gt;
&lt;P&gt;So add this dot:&lt;/P&gt;
&lt;PRE&gt; 98         define price / display format=$nozero.;
 99         run;
 
 ERROR: price must use a numeric format.
&lt;/PRE&gt;
&lt;P&gt;and now you get the message about the numeric format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The examples in the PROC REPORT documentation (like&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/proc/n1jfpsg4rtte8bn1bg958uj3yfg5.htm" target="_blank" rel="noopener"&gt;here&lt;/A&gt;) contain correct format references.&lt;/P&gt;
&lt;P&gt;Maxim 1 is the first maxim for a reason.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Aug 2021 09:28:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/output-proc-report-No-zeros/m-p/760873#M240667</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-08-11T09:28:52Z</dc:date>
    </item>
    <item>
      <title>Re: output proc report: No zeros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/output-proc-report-No-zeros/m-p/761099#M240778</link>
      <description>&lt;P&gt;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/216503" target="_blank" rel="noopener"&gt;@all&lt;/A&gt;: Thank you for your help, pretty helpful! It works! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;But Ive one more question: In some cells the result is not 0 but empty. In the output it results in a point. But empty cells also should be a "-". I tried it with this code but it doesnt work. Could you please give me another hink?&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=" language-sas"&gt;proc format;
  value nozero 
		0='-' other=[best10.2];
  value nopoint
  		"" ="-" other=[best10.2];
run;

proc report data=...&lt;BR /&gt;[...]
define Jahr_&amp;amp;Jahr1. / 
	display "Data" 
	style={cellwidth=5 cm} 
	format=nozero.;
	format=nopoint.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Aug 2021 09:15:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/output-proc-report-No-zeros/m-p/761099#M240778</guid>
      <dc:creator>Konkordanz</dc:creator>
      <dc:date>2021-08-12T09:15:59Z</dc:date>
    </item>
    <item>
      <title>Re: output proc report: No zeros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/output-proc-report-No-zeros/m-p/761100#M240779</link>
      <description>&lt;P&gt;You can attach only one format to a variable / column. Try:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
  value nozero 
    0, . ='-' 
    other=[best10.2];
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Aug 2021 09:18:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/output-proc-report-No-zeros/m-p/761100#M240779</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-08-12T09:18:18Z</dc:date>
    </item>
    <item>
      <title>Re: output proc report: No zeros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/output-proc-report-No-zeros/m-p/761104#M240781</link>
      <description>&lt;P&gt;Thank you all, this forum is very helpful and important for me!&lt;/P&gt;</description>
      <pubDate>Thu, 12 Aug 2021 09:47:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/output-proc-report-No-zeros/m-p/761104#M240781</guid>
      <dc:creator>Konkordanz</dc:creator>
      <dc:date>2021-08-12T09:47:51Z</dc:date>
    </item>
  </channel>
</rss>

