<?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: Issue with my bands in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Issue-with-my-bands/m-p/605680#M35136</link>
    <description>&lt;P&gt;Is something wrong when you run it? If so, please post your log.&lt;/P&gt;</description>
    <pubDate>Wed, 20 Nov 2019 11:33:15 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2019-11-20T11:33:15Z</dc:date>
    <item>
      <title>Issue with my bands</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Issue-with-my-bands/m-p/605679#M35135</link>
      <description>&lt;P&gt;Folks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a macro which I'm using to convert a value into a band however I'm running into problems. Can anyone see what is going wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro bands (yr);

data banded_&amp;amp;yr;
format claimed_band_&amp;amp;yr unclaimed_band_&amp;amp;yr $100.;
set cohort_&amp;amp;yr;
if claimed_&amp;amp;yr=0 or claimed_&amp;amp;yr=. then claimed_band_&amp;amp;yr='Zero';
else if claimed_&amp;amp;yr &amp;gt;=1 and claimed_&amp;amp;yr &amp;lt;=25000  then claimed_band_&amp;amp;yr='1 to 25,000';
else if claimed_&amp;amp;yr &amp;gt;=25001 and claimed_&amp;amp;yr &amp;lt;=50000  then claimed_band_&amp;amp;yr='25,001 to 50,000';
else if claimed_&amp;amp;yr &amp;gt;=50001 and claimed_&amp;amp;yr &amp;lt;=750000  then claimed_band_&amp;amp;yr='50,001 to 75,000';
else if claimed_&amp;amp;yr &amp;gt;=75001 and claimed_&amp;amp;yr &amp;lt;=100000  then claimed_band_&amp;amp;yr='75,001 to 100,000';
else if claimed_&amp;amp;yr &amp;gt;=100001 and claimed_&amp;amp;yr &amp;lt;=200000  then claimed_band_&amp;amp;yr='100,001 to 200,000';
else if claimed_&amp;amp;yr &amp;gt;=200001 and claimed_&amp;amp;yr &amp;lt;=300000  then claimed_band_&amp;amp;yr='200,001 to 300,000';
else if claimed_&amp;amp;yr &amp;gt;=300001 and claimed_&amp;amp;yr &amp;lt;=400000  then claimed_band_&amp;amp;yr='300,001 to 400,000';
else if claimed_&amp;amp;yr &amp;gt;=400001 and claimed_&amp;amp;yr &amp;lt;=500000  then claimed_band_&amp;amp;yr='400,001 to 500,000';
else if claimed_&amp;amp;yr &amp;gt;=500001 and claimed_&amp;amp;yr &amp;lt;=600000  then claimed_band_&amp;amp;yr='500,001 to 600,000';
else if claimed_&amp;amp;yr &amp;gt;=600001 and claimed_&amp;amp;yr &amp;lt;=700000  then claimed_band_&amp;amp;yr='600,001 to 700,000';
else if claimed_&amp;amp;yr &amp;gt;=700001 and claimed_&amp;amp;yr &amp;lt;=800000  then claimed_band_&amp;amp;yr='700,001 to 800,000';
else if claimed_&amp;amp;yr &amp;gt;=800001 and claimed_&amp;amp;yr &amp;lt;=900000  then claimed_band_&amp;amp;yr='800,001 to 900,000';
else if claimed_&amp;amp;yr &amp;gt;=900001 and claimed_&amp;amp;yr &amp;lt;=1000000  then claimed_band_&amp;amp;yr='900,001 to 1,000,000';
else if claimed_&amp;amp;yr &amp;gt;=1000001 and claimed_&amp;amp;yr &amp;lt;=5000000  then claimed_band_&amp;amp;yr='1,000,001 to 5,000,000';
else if claimed_&amp;amp;yr &amp;gt;=5000001 and claimed_&amp;amp;yr &amp;lt;=10000000  then claimed_band_&amp;amp;yr='5,000,001 to 10,000,000';
else if claimed_&amp;amp;yr &amp;gt;10000000  then claimed_band_&amp;amp;yr='Greater than 10,000,000';
if unused_&amp;amp;yr=0 or unused_&amp;amp;yr=. then unclaimed_band_&amp;amp;yr='Zero';
else if unused_&amp;amp;yr &amp;gt;=1 and unused_&amp;amp;yr &amp;lt;=25000  then unclaimed_band_&amp;amp;yr='1 to 25,000';
else if unused_&amp;amp;yr &amp;gt;=25001 and unused_&amp;amp;yr &amp;lt;=50000  then unclaimed_band_&amp;amp;yr='25,001 to 50,000';
else if unused_&amp;amp;yr &amp;gt;=50001 and unused_&amp;amp;yr &amp;lt;=750000  then unclaimed_band_&amp;amp;yr='50,001 to 75,000';
else if unused_&amp;amp;yr &amp;gt;=75001 and unused_&amp;amp;yr &amp;lt;=100000  then unclaimed_band_&amp;amp;yr='75,001 to 100,000';
else if unused_&amp;amp;yr &amp;gt;=100001 and unused_&amp;amp;yr &amp;lt;=200000  then unclaimed_band_&amp;amp;yr='100,001 to 200,000';
else if unused_&amp;amp;yr &amp;gt;=200001 and unused_&amp;amp;yr &amp;lt;=300000  then unclaimed_band_&amp;amp;yr='200,001 to 300,000';
else if unused_&amp;amp;yr &amp;gt;=300001 and unused_&amp;amp;yr &amp;lt;=400000  then unclaimed_band_&amp;amp;yr='300,001 to 400,000';
else if unused_&amp;amp;yr &amp;gt;=400001 and unused_&amp;amp;yr &amp;lt;=500000  then unclaimed_band_&amp;amp;yr='400,001 to 500,000';
else if unused_&amp;amp;yr &amp;gt;=500001 and unused_&amp;amp;yr &amp;lt;=600000  then unclaimed_band_&amp;amp;yr='500,001 to 600,000';
else if unused_&amp;amp;yr &amp;gt;=600001 and unused_&amp;amp;yr &amp;lt;=700000  then unclaimed_band_&amp;amp;yr='600,001 to 700,000';
else if unused_&amp;amp;yr &amp;gt;=700001 and unused_&amp;amp;yr &amp;lt;=800000  then unclaimed_band_&amp;amp;yr='700,001 to 800,000';
else if unused_&amp;amp;yr &amp;gt;=800001 and unused_&amp;amp;yr &amp;lt;=900000  then unclaimed_band_&amp;amp;yr='800,001 to 900,000';
else if unused_&amp;amp;yr &amp;gt;=900001 and unused_&amp;amp;yr &amp;lt;=1000000  then unclaimed_band_&amp;amp;yr='900,001 to 1,000,000';
else if unused_&amp;amp;yr &amp;gt;=1000001 and unused_&amp;amp;yr &amp;lt;=5000000  then unclaimed_band_&amp;amp;yr='1,000,001 to 5,000,000';
else if unused_&amp;amp;yr &amp;gt;=5000001 and unused_&amp;amp;yr &amp;lt;=10000000  then unclaimed_band_&amp;amp;yr='5,000,001 to 10,000,000';
else if unused_&amp;amp;yr &amp;gt;10000000  then unclaimed_band_&amp;amp;yr='Greater than 10,000,000';
val=1;
run;

proc summary data=banded_&amp;amp;yr;
class claimed_band_&amp;amp;yr;
var val;
output out=test_&amp;amp;yr
sum=;
run;




%mend bands;
%bands (5);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Nov 2019 11:31:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Issue-with-my-bands/m-p/605679#M35135</guid>
      <dc:creator>Sean_OConnor</dc:creator>
      <dc:date>2019-11-20T11:31:32Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with my bands</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Issue-with-my-bands/m-p/605680#M35136</link>
      <description>&lt;P&gt;Is something wrong when you run it? If so, please post your log.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 11:33:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Issue-with-my-bands/m-p/605680#M35136</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-11-20T11:33:15Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with my bands</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Issue-with-my-bands/m-p/605681#M35137</link>
      <description>&lt;P&gt;When I look at the outputted dataset I see that some records are placed into the wrong band. So for instance a record where claimed_&amp;amp;year = 107,148 is being having a band written down as between 50,001 to 75,000&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 11:36:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Issue-with-my-bands/m-p/605681#M35137</guid>
      <dc:creator>Sean_OConnor</dc:creator>
      <dc:date>2019-11-20T11:36:29Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with my bands</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Issue-with-my-bands/m-p/605682#M35138</link>
      <description>&lt;P&gt;You have an extra 0 in this line&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;else if claimed_&amp;amp;yr &amp;gt;=50001 and claimed_&amp;amp;yr &amp;lt;=750000  then claimed_band_&amp;amp;yr='50,001 to 75,000';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This should be&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;else if claimed_&amp;amp;yr &amp;gt;=50001 and claimed_&amp;amp;yr &amp;lt;=75000  then claimed_band_&amp;amp;yr='50,001 to 75,000';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 11:44:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Issue-with-my-bands/m-p/605682#M35138</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-11-20T11:44:34Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with my bands</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Issue-with-my-bands/m-p/605686#M35139</link>
      <description>&lt;P&gt;DO NOT do this with such a massive if/then/else avalanche. Create formats instead and make your code maintainable.&lt;/P&gt;
&lt;P&gt;And if you have certain fractional values (e.g. 25000.5), these will have no result.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 11:56:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Issue-with-my-bands/m-p/605686#M35139</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-11-20T11:56:01Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with my bands</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Issue-with-my-bands/m-p/605693#M35140</link>
      <description>&lt;P&gt;Just see this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value claimed_band
  low - 0 = 'Zero'
  0 &amp;lt;- 25000 = '1 to 25,000'
  25000 &amp;lt;- 50000 = '25,001 to 50,000'
  50000 &amp;lt;- 75000 = '50,001 to 75,000'
  75000 &amp;lt;- 100000 = '75,001 to 100,000'
  100000 &amp;lt;- 200000 = '100,001 to 200,000'
  200000 &amp;lt;- 300000 = '200,001 to 300,000'
  300000 &amp;lt;- 400000 = '300,001 to 400,000'
  400000 &amp;lt;- 500000 = '400,001 to 500,000'
  500000 &amp;lt;- 600000 = '500,001 to 600,000'
  600000 &amp;lt;- 700000 = '600,001 to 700,000'
  700000 &amp;lt;- 800000 = '700,001 to 800,000'
  800000 &amp;lt;- 900000 = '800,001 to 900,000'
  900000 &amp;lt;- 1000000 = '900,001 to 1,000,000'
  1000000 &amp;lt;- 5000000 = '1,000,001 to 5,000,000'
  5000000 &amp;lt;- 10000000 = '5,000,001 to 10,000,000'
  10000000 &amp;lt;- high = 'Greater than 10,000,000'
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This format will catch ALL values, regardless of fractions. It is easier to maintain than the if/then/else blocks, and reusable. Your code will then become&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro bands(yr);

data banded_&amp;amp;yr;
length claimed_band_&amp;amp;yr unclaimed_band_&amp;amp;yr $100.;
set cohort_&amp;amp;yr;
claimed_band_&amp;amp;yr = put(claimed_&amp;amp;yr,claimed_band.);
unclaimed_band_&amp;amp;yr = put(unused_&amp;amp;yr,claimed_band.);
val = 1;
run;

proc summary data=banded_&amp;amp;yr;
class claimed_band_&amp;amp;yr;
var val;
output
  out=test_&amp;amp;yr
  sum=
;
run;

%mend bands;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Nov 2019 12:12:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Issue-with-my-bands/m-p/605693#M35140</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-11-20T12:12:48Z</dc:date>
    </item>
  </channel>
</rss>

