<?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: Incorrect results cross-tab table when formatting two variables into bands in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Incorrect-results-cross-tab-table-when-formatting-two-variables/m-p/556849#M155152</link>
    <description>&lt;P&gt;You really need to provide some of YOUR data that does not "band" correctly so we can see what might be going on. &lt;BR /&gt;A random generated data set does not tell us what your specific issue is, especially since your example "like this" is not populated with any values&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that BOTH of your posted formats may have issues because you do not end the value with a semicolon. But the big issue is likely that you gave BOTH of the "formats" the same name. So the second "overunder" format overwrote the first one. Each format needs it's own name if you want different "bands".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data example;
 do cost = . , -1, 0, .5, 1, 1.5;
   do money_limit = . , -1, 0, .5, 1, 1.5;
   output;
   end;
 end;
run;
proc format library=work;
value money_limit
  0               = 'money_limit = 0'
  low -&amp;lt; 0    = 'money_limit &amp;lt; 0'
  0 &amp;lt;- high  = 'money_limit &amp;gt; 0'
;
value cost
  0              = 'COST = 0'
  low -&amp;lt; 0   = 'COST &amp;lt; 0'
  0 &amp;lt;-&amp;lt; 1    = '0 &amp;lt; COST &amp;lt; 1'
  1             = 'COST = 1'
  ;
run;

proc freq data=example;
   tables cost*money_limit / nocum norow nocol out=want;
   format money_limit overunder.;;
   format cost cost. money_limit money_limit.;
run;&lt;/PRE&gt;</description>
    <pubDate>Tue, 07 May 2019 16:31:29 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-05-07T16:31:29Z</dc:date>
    <item>
      <title>Incorrect results cross-tab table when formatting two variables into bands</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Incorrect-results-cross-tab-table-when-formatting-two-variables/m-p/556839#M155149</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following code below but the formatting in the results table does not band correctly for the first variable, 'money_limit' but does band correctly in the results table for the second variable, 'COST' - can someone please edit my code so that the results table correctly bands the results for both variables, similar to an example below? Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="money split and COST.PNG" style="width: 542px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29273iACAA338C569CC2E8/image-size/large?v=v2&amp;amp;px=999" role="button" title="money split and COST.PNG" alt="money split and COST.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently, it looks something like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="money split and COST old.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29274iCFA88C7C616448FE/image-size/large?v=v2&amp;amp;px=999" role="button" title="money split and COST old.PNG" alt="money split and COST old.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data money_analysis;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;set rd.accounts;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data money_split;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;do x=1 to 1000;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;money_limit=rand('uniform');&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;output;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;end;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;do x=1 to 100;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;credit_limit=0;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;output;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc format library=work;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;value overunder&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= 'money_limit = 0'&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;low -&amp;lt; 0&amp;nbsp; &amp;nbsp; = 'money_limit &amp;lt; 0'&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;lt;- high&amp;nbsp; = 'money_limit &amp;gt; 0' ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data PD_C_12_split;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;do x=1 to 1000;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;COST=rand('uniform');&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;output;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;end;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;do x=1 to 100;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;COST=0;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;output;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc format library=work;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;value overunder&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; = 'COST = 0'&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;low -&amp;lt; 0&amp;nbsp; &amp;nbsp;= 'COST &amp;lt; 0'&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;lt;-&amp;lt; 1&amp;nbsp; &amp;nbsp; = '0 &amp;lt; COST &amp;lt; 1'&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= 'COST = 1' ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc freq data=money_analysis;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;tables COST*money_limit / nocum norow nocol out=want;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;format money_limit overunder.;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;format COST overunder.;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2019 16:38:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Incorrect-results-cross-tab-table-when-formatting-two-variables/m-p/556839#M155149</guid>
      <dc:creator>jeremy4</dc:creator>
      <dc:date>2019-05-07T16:38:04Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect results cross-tab table when formatting two variables into bands</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Incorrect-results-cross-tab-table-when-formatting-two-variables/m-p/556849#M155152</link>
      <description>&lt;P&gt;You really need to provide some of YOUR data that does not "band" correctly so we can see what might be going on. &lt;BR /&gt;A random generated data set does not tell us what your specific issue is, especially since your example "like this" is not populated with any values&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that BOTH of your posted formats may have issues because you do not end the value with a semicolon. But the big issue is likely that you gave BOTH of the "formats" the same name. So the second "overunder" format overwrote the first one. Each format needs it's own name if you want different "bands".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data example;
 do cost = . , -1, 0, .5, 1, 1.5;
   do money_limit = . , -1, 0, .5, 1, 1.5;
   output;
   end;
 end;
run;
proc format library=work;
value money_limit
  0               = 'money_limit = 0'
  low -&amp;lt; 0    = 'money_limit &amp;lt; 0'
  0 &amp;lt;- high  = 'money_limit &amp;gt; 0'
;
value cost
  0              = 'COST = 0'
  low -&amp;lt; 0   = 'COST &amp;lt; 0'
  0 &amp;lt;-&amp;lt; 1    = '0 &amp;lt; COST &amp;lt; 1'
  1             = 'COST = 1'
  ;
run;

proc freq data=example;
   tables cost*money_limit / nocum norow nocol out=want;
   format money_limit overunder.;;
   format cost cost. money_limit money_limit.;
run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 May 2019 16:31:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Incorrect-results-cross-tab-table-when-formatting-two-variables/m-p/556849#M155152</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-05-07T16:31:29Z</dc:date>
    </item>
  </channel>
</rss>

