<?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: binning a continuous variable for further analysis in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/binning-a-continuous-variable-for-further-analysis/m-p/564618#M158396</link>
    <description>&lt;P&gt;You could use an iterative DO statement with a list of values, as in this example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data binned;
set sashelp.class;
ageBin = 0;
do i = 12, 14, 15;
    if age &amp;lt; i then leave;
    ageBin + 1;
    end;
heightBin = 0;
do i = 55, 60, 65;
    if height &amp;lt; i then leave;
    heightBin + 1;
    end;
weightBin = 0;
do i = 80, 87, 100;
    if weight &amp;lt; i then leave;
    weightBin + 1;
    end;
drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It is simple enough that a macro would seem like overkill.&lt;/P&gt;</description>
    <pubDate>Sat, 08 Jun 2019 03:38:39 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2019-06-08T03:38:39Z</dc:date>
    <item>
      <title>binning a continuous variable for further analysis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/binning-a-continuous-variable-for-further-analysis/m-p/564608#M158393</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I have one sas dataset on which I want to create&amp;nbsp;more than 10 continuous bins based on different criteria like for example:&lt;/P&gt;&lt;P&gt;for age &amp;lt;=18,18-25,25-50,&amp;gt;50&lt;/P&gt;&lt;P&gt;for balance &amp;lt;15000,15000-25000,25000-35000,&amp;gt;35000&lt;/P&gt;&lt;P&gt;for transactions &amp;lt;=5,5-10,10-15,&amp;gt;15 and so on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know this can be done using proc format and if then else statement.I was just wondering to create a macro to optimize this process by limiting the repetitive if then else condition.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hence,I am looking for some inputs/ideas to start working on it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jun 2019 01:44:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/binning-a-continuous-variable-for-further-analysis/m-p/564608#M158393</guid>
      <dc:creator>Fabeeha</dc:creator>
      <dc:date>2019-06-08T01:44:04Z</dc:date>
    </item>
    <item>
      <title>Re: binning a continuous variable for further analysis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/binning-a-continuous-variable-for-further-analysis/m-p/564618#M158396</link>
      <description>&lt;P&gt;You could use an iterative DO statement with a list of values, as in this example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data binned;
set sashelp.class;
ageBin = 0;
do i = 12, 14, 15;
    if age &amp;lt; i then leave;
    ageBin + 1;
    end;
heightBin = 0;
do i = 55, 60, 65;
    if height &amp;lt; i then leave;
    heightBin + 1;
    end;
weightBin = 0;
do i = 80, 87, 100;
    if weight &amp;lt; i then leave;
    weightBin + 1;
    end;
drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It is simple enough that a macro would seem like overkill.&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jun 2019 03:38:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/binning-a-continuous-variable-for-further-analysis/m-p/564618#M158396</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-06-08T03:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: binning a continuous variable for further analysis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/binning-a-continuous-variable-for-further-analysis/m-p/564619#M158397</link>
      <description>&lt;P&gt;interesting way of doing it.Thanks for sharing.&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jun 2019 03:51:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/binning-a-continuous-variable-for-further-analysis/m-p/564619#M158397</guid>
      <dc:creator>Fabeeha</dc:creator>
      <dc:date>2019-06-08T03:51:57Z</dc:date>
    </item>
    <item>
      <title>Re: binning a continuous variable for further analysis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/binning-a-continuous-variable-for-further-analysis/m-p/564934#M158515</link>
      <description>&lt;P&gt;Before even attempting any programming from a general rule you should get into a habit of thinking of which end points are inclusive or exclusive.&lt;/P&gt;
&lt;P&gt;Everyone of your examples has shared endpoints. And in most of them&amp;nbsp;I would not know in a report which category several values, such as age exactly = 25, the value is reported.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 16:12:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/binning-a-continuous-variable-for-further-analysis/m-p/564934#M158515</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-06-10T16:12:28Z</dc:date>
    </item>
  </channel>
</rss>

