<?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: Error when trying to apply user-defined format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-apply-user-defined-format/m-p/479029#M123596</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Add an option before PROC FORMAT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;options&amp;nbsp; cmplib=work.functions ;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;proc format...........&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;.......&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;... &lt;EM&gt;and&lt;/EM&gt; use the function names as format names (see &lt;A href="http://documentation.sas.com/?docsetId=proc&amp;amp;docsetTarget=p1upn25lbfo6mkn1wncu4dyh9q91.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;documentation&lt;/A&gt;), i.e.&amp;nbsp;&lt;FONT face="courier new,courier"&gt;value &lt;STRONG&gt;suppt&lt;/STRONG&gt;&lt;/FONT&gt; etc.&lt;/P&gt;</description>
    <pubDate>Wed, 18 Jul 2018 13:16:49 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2018-07-18T13:16:49Z</dc:date>
    <item>
      <title>Error when trying to apply user-defined format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-apply-user-defined-format/m-p/479006#M123592</link>
      <description>&lt;P&gt;I have inherited some code that creates a user-defined function and format (later used in proc tabulate statement) that is not working.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can anyone help?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Code below:-&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;* Create a function that rounds small &amp;amp; missing numbers to zero (amended fromn standard supprnd function code as in this instance we need to create a numeric variable for later calculations);&lt;BR /&gt; proc fcmp outlib=work.functions.misc;&lt;BR /&gt; function suppf(x);&lt;BR /&gt; length y 16;&lt;BR /&gt; if ( missing(x) OR x in (1, 2) ) then y = 0; /* suppress disclosive values */&lt;BR /&gt; else do;&lt;BR /&gt; x2 = round(x, 5); /* round to nearest 5 */&lt;BR /&gt; y = put(x2, 32.);&lt;BR /&gt; end;&lt;BR /&gt; return(compress(y));&lt;BR /&gt; endsub;&lt;BR /&gt; /*Add function to round to nearest 10 for current cycle reporting*/&lt;BR /&gt; function suppt(x);&lt;BR /&gt; length y 16;&lt;BR /&gt; if ( missing(x) OR x in (1, 2) ) then y = 0; /* suppress disclosive values */&lt;BR /&gt; else do;&lt;BR /&gt; x2 = round(x, 10); /* round to nearest 5 */&lt;BR /&gt; y = put(x2, 32.);&lt;BR /&gt; end;&lt;BR /&gt; return(compress(y));&lt;BR /&gt; endsub;&lt;/P&gt;
&lt;P&gt;/* suppress disclosive values, but do not round other values */&lt;BR /&gt; function suppr_s(x) $;&lt;BR /&gt; length y $30;&lt;BR /&gt; if ( missing(x) OR x in (1, 2) ) then y = '--'; /* suppress disclosive values */&lt;BR /&gt; else do;&lt;BR /&gt; y = put(x, 32.);&lt;BR /&gt; end;&lt;BR /&gt; return(compress(y));&lt;BR /&gt; endsub;&lt;BR /&gt; run;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt; proc format;&lt;BR /&gt; /* Format for rounding */&lt;BR /&gt; value supp_t&lt;BR /&gt; other = [suppt()]; /* suppress disclosive values &amp;amp; round to nearest 10 */&lt;BR /&gt; value supp_f&lt;BR /&gt; other = [suppf()]; /* suppress disclosive values &amp;amp; round to nearest 5 */&lt;BR /&gt; value suppress&lt;BR /&gt; other = [suppr_s()]; /* suppress disclosive values only */&lt;BR /&gt; quit;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jul 2018 12:23:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-apply-user-defined-format/m-p/479006#M123592</guid>
      <dc:creator>kimdukes77</dc:creator>
      <dc:date>2018-07-18T12:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: Error when trying to apply user-defined format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-apply-user-defined-format/m-p/479019#M123594</link>
      <description>&lt;P&gt;Add an option before PROC FORMAT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;options&amp;nbsp; cmplib=work.functions ;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;proc format...........&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;.......&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jul 2018 13:03:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-apply-user-defined-format/m-p/479019#M123594</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-07-18T13:03:26Z</dc:date>
    </item>
    <item>
      <title>Re: Error when trying to apply user-defined format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-apply-user-defined-format/m-p/479028#M123595</link>
      <description>&lt;P&gt;Works a treat - thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jul 2018 13:16:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-apply-user-defined-format/m-p/479028#M123595</guid>
      <dc:creator>kimdukes77</dc:creator>
      <dc:date>2018-07-18T13:16:47Z</dc:date>
    </item>
    <item>
      <title>Re: Error when trying to apply user-defined format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-apply-user-defined-format/m-p/479029#M123596</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Add an option before PROC FORMAT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;options&amp;nbsp; cmplib=work.functions ;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;proc format...........&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;.......&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;... &lt;EM&gt;and&lt;/EM&gt; use the function names as format names (see &lt;A href="http://documentation.sas.com/?docsetId=proc&amp;amp;docsetTarget=p1upn25lbfo6mkn1wncu4dyh9q91.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;documentation&lt;/A&gt;), i.e.&amp;nbsp;&lt;FONT face="courier new,courier"&gt;value &lt;STRONG&gt;suppt&lt;/STRONG&gt;&lt;/FONT&gt; etc.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jul 2018 13:16:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-apply-user-defined-format/m-p/479029#M123596</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2018-07-18T13:16:49Z</dc:date>
    </item>
  </channel>
</rss>

